setHSL (NotesColorObject - JavaScript)

Sets an HSL value to the closest Domino® color and RGB value.

Defined in

NotesColorObject

Syntax

setHSL(hue:int, saturation:int, luminance:int) : int
Parameter Description
hue Hue component of the HSL value. Must be in the range 0-240.
saturation Saturation component of the HSL value. Must be in the range 0-240.
luminance Luminance component of the HSL value. Must be in the range 0-240.
Return value Description
int Closest Domino® color to the HSL value.

Usage

SetHSL sets NotesColor, in addition to the return value, to the closest Domino® color.

SetHSL sets the HSL properties to the specifications of this method.

SetHSL sets the RGB properties to values that match the Domino® color.

Language cross-reference

SetHSL method in LotusScript® NotesColorObject class

setHSL method in Java ColorObject class

Examples

This button control sets a color according to the hue, saturation, and luminance values from scoped variables bound to input box controls. It assigns the Domino®, RGB, and HSL values of the color to scoped variables bound to input box controls.
var color = session.createColorObject();
try {
		 if (isNaN(requestScope.hue)) throw ("Hue value must be numeric");
		 if (isNaN(requestScope.saturation)) throw ("Saturation value must be numeric");
		 if (isNaN(requestScope.luminance)) throw ("Luminance value must be numeric");
		 var hue = parseInt(requestScope.hue, 10);
		 var saturation = parseInt(requestScope.saturation, 10);
		 var luminance = parseInt(requestScope.luminance, 10);
		 if (hue < 0 || hue > 240) throw ("Hue value must be 0 - 240");
		 if (saturation < 0 || saturation > 240) throw ("Saturation value must be 0 - 240");
		 if (luminance < 0 || luminance > 240) throw ("Luminance value must be 0 - 240");
		 color.setHSL(hue, saturation, luminance);
		 requestScope.notescolor = color.getNotesColor().toFixed();
		 requestScope.red = color.getRed().toFixed();
		 requestScope.green = color.getGreen().toFixed();
		 requestScope.blue = color.getBlue().toFixed();
		 requestScope.hue = color.getHue().toFixed();
		 requestScope.saturation = color.getSaturation().toFixed();
		 requestScope.luminance = color.getLuminance().toFixed();
		 requestScope.status = "Success";
} catch(e) {
		 requestScope.status = e.toString();
}