Brian Dunning's FileMaker Custom Functions

RGBtoHSL ( redPercentage ; greenPercentage ; bluePercentage )

Converts color from RGB percentages to HSL values.

  Average rating: 4.4 (24 votes) Log in to vote

Joe Rovang   Joe Rovang - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
RGBtoHSL ( 1; 0; 0 ) // red
  Sample output:


.5

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

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

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.

 

Comments

Alexander Zueiv   Alexander Zueiv, Tashkent
Oct 20, 2012
The example RGBtoHSL ( 1; 0; 0 ) returns "0¶?¶1".

The mistake is probably in the line 14:

sumC = maxC + maxC;

It should probably be:

sumC = maxC + minC;

Is that correct?
 
Joe Rovang   Joe Rovang
Oct 20, 2012
Yes, thanks, careless translation from Java. Edited.
 

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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: