HexToDecRGB ( Hex )
Convert hex color format string to RGB color format string
Average rating: 4.8 (28 votes) Log in to vote
Federico Severin - Show more from this author
Sevesoftware Engineering http://www.sevesoftware.it |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Every color component is separately converted from hexadecimal to decimal format. Each value is filled with zeroes behind (if necessary) to get a fixed length string.
The result is a 9 chars string with three digits for each component in decimal format.
Comments
HazMatt, Blaine, MN, USA Jul 18, 2014 |
||
Italian to English… Dichiara = Let Refila = Trim CercaeSost = Substitute Mezzo = Middle Posizione = Position Sinistra = Left Destra = Right Casi = Case Lunghezza = Length RicavaComeTesto = GetAsText I'm pretty sure I got those all right! |
||
oliver Aug 15, 2014 |
||
So in English this is Let ([ Hex = Trim ( Substitute ( Hex ; "#" ; "" ) ) ; HexCharset = "0123456789ABCDEF" ; RHex = Middle ( Hex ; 1 ; 2 ) ; GHex = Middle ( Hex ; 3 ; 2 ) ; BHex = Middle ( Hex ; 5 ; 2 ) ; R = 16 * ( Position ( HexCharset ; Left ( RHex ; 1 ) ; 1 ; 1 ) - 1 ) + ( Position ( HexCharset ; Right ( RHex ; 1 ) ; 1 ; 1 ) - 1 ) ; G = 16 * ( Position ( HexCharset ; Left ( GHex ; 1 ) ; 1 ; 1 ) - 1 ) + ( Position ( HexCharset ; Right ( GHex ; 1 ) ; 1 ; 1 ) - 1 ) ; B = 16 * ( Position ( HexCharset ; Left ( BHex ; 1 ) ; 1 ; 1 ) - 1 ) + ( Position ( HexCharset ; Right ( BHex ; 1 ) ; 1 ; 1 ) - 1 ) ]; // R Case ( Length ( R ) = 1 ; "00" ; Length ( R ) = 2 ; "0" ; ) & GetAsText ( R ) & // G Case ( Length ( G ) = 1 ; "00" ; Length ( G ) = 2 ; "0" ; ) & GetAsText ( G ) & // B Case ( Length ( B ) = 1 ; "00" ; Length ( B ) = 2 ; "0" ; ) & GetAsText ( B ) ) // End Let |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.