Brian Dunning's FileMaker Custom Functions

RGBtoHSB ( redPercentage ; greenPercentage ; bluePercentage )

Converts color from RGB percentages to HSB/HSV values.

  Average rating: 4.1 (33 votes) Log in to vote

Joe Rovang   Joe Rovang

Share on Facebook Share on Twitter

  Sample input:
RGBtoHSB ( 0 ; 0 ; .5 )
  Sample output:
240
1
.5

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Parameters:
redPercentage
greenPercentage
bluePercentage

This function converts the specified color RGB percentages to hue, saturation, and brightness (HSB/HSV) values. (Note that HSB/HSV is not the same as HSL!)

Note that all values except hue are in decimals between 0 and 1, inclusively. RGB values on the 0-255 scale must be divided by 255 before using them in this function.

The math behind this function was inspired by formulas listed on Wikipedia.

 

Comments

Guy Foster   Guy Foster, Fort Lauderdale, FL
Jan 28, 2012
Hi Joe, Entered your RGBtoHSB function into FM11 Advanced with no problem, but results are bizzare. Entered 239, 200, 16 as RGB numbers, divided all three by 255, passed parameters to function, answer:
49.50672xxx
.933054xxx
.937254xxx

Can I contact you directly for help. Be glad to pay. Have almost 5000 threads with only RGB numbers that I need to convert. Thx. guy007@usa.net
PS: My second custom function, so new at this process.
 

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.