Brian Dunning's FileMaker Custom Functions

HexToRGB ( Hex ; RGorB )

Returns a decimal integer that represents a color obtained by converting standard 6 character hexadecimal input.

  Average rating: 4.2 (39 votes) Log in to vote

Jeremiah Small   Jeremiah Small
Soliant Consulting, Inc.
https://www.soliantconsulting.com

Share on Facebook Share on Twitter

  Sample input:
HexToRGB ( "#FFFF00" ; "R" )
HexToRGB ( "#FFFF00" ; "RGB" )
  Sample output:
255
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   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   Math, Paris, France
Aug 22, 2017
Exactly what I search. it's works well, Thanx.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.