HexToRGB ( Hex ; RGorB )
Returns a decimal integer that represents a color obtained by converting standard 6 character hexadecimal input.
Average rating: 4.2 (40 votes) Log in to vote
Jeremiah Small - Show more from this author
Soliant Consulting, Inc. https://www.soliantconsulting.com |
HexToRGB ( "#FFFF00" ; "RGB" )
16776960
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Returns an integer that represents a color obtained by converting standard 6 character hexadecimal input.
If you pass any value to the RGorB param other than "R" or "G" or "B" the function will return the full spectrum decimal value.
The RGorB parameter is a switch modifies the calculation to return only the red, green or blue decimal value of Hex.
Hex = Hexadecimal input. Handles inputs containing leading/trailing spaces and/or # symbol.
RGorB = Switch that determines the spectrum of output ( "R" = red; "G" = green; "B" = Blue; "RGB" or "0" or [not null] = RGB ).
Comments
Nick Lightbody, Deskspace Systems Limited Aug 28, 2016 |
||
Just a quick thanks Jeremy, you donated this many years ago and today it very neatly solved a problem for me. Cheers, Nick |
||
Math, Paris, France Aug 22, 2017 |
||
Exactly what I search. it's works well, Thanx. | ||
Tom Guise, Smart Wolf Apr 4, 2022 |
||
Thanks Jeremiah! I'm using this to covert Hex to the RGBA format required for Javascript charts using Chart.js as follows (incase it's useful for anybody else reading this): // Requires: HexToRGB // https://www.briandunning.com/cf/115 Let ( [ R = HexToRGB ( Hex ; "R" ) ; // Red G = HexToRGB ( Hex ; "G" ) ; // Green B = HexToRGB ( Hex ; "B" ) ; // Blue A = 1 // Alpha ] ; "rgba(" & R & "," & G & "," & B & "," & A & ")" ) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.