This class contains methods that can be helpful when working with color (in particular color models: RGB, HSV, etc.).
The package name of this class is hubitat.helper. So to use in an app or driver, you would reference it with hubitat.helper.ColorUtils.
Convert RGB hex string to list of rgb values.
List hexToRGB(String hexRGB)
hexRGB - RGB hex value prepended with "#"
List - The hexRGB string returned as a list of Integer values.
log.debug hubitat.helper.ColorUtils.hexToRGB("#7EFF00") == [126,255,0]
Convert RGB list value to hex string.
String rgbToHEX(List RGB)
RGB - Red, Green, Blue (valid values are 0..255)
String - The RGB value of the integer list encoded as a hex string.
log.debug hubitat.helper.ColorUtils.rgbToHEX([126,255,0]) == "#7EFF00"
Convert RGB list values to Hue, Saturation and Level list
List rgbToHSV(List RGB)
List - the rgb list to convert
List - Hue, Saturation and Level
log.debug hubitat.helper.ColorUtils.rgbToHSV([126,255,0])
// == [25.1, 100.0, 100.0]
Convert Hue, Saturation and Level list to rgb list
List hsvToRGB(List HSV)
List - the hsv list to convert. (valid values are 0..100)
List - The HSV List returned as a list of rgb Integer values.
log.debug hubitat.helper.ColorUtils.hsvToRGB([25.1, 100.0, 100.0]) == [126, 255, 0]