Difference between revisions of "ColorUtils Object"

From Hubitat Documentation
Jump to: navigation, search
(Created page with "==Description== 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. == <code>hexToRGB</cod...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Description==
 
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.
 
  
== <code>hexToRGB</code> ==
+
<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big>
Convert RGB hex string to list of rgb values.
 
  
'''Signature'''
+
<big>
List hexToRGB(String hexRGB)
+
This document is available at: http://docs2.hubitat.com/en/developer/colorutils-object
 
+
</big>
'''Parameters'''
 
 
 
hexRGB - RGB hex value prepended with "#"
 
 
 
'''Returns'''
 
 
 
List - The hexRGB string returned as a list of Integer values.
 
 
 
'''Example'''
 
log.debug  hubitat.helper.ColorUtils.hexToRGB("#7EFF00") == [126,255,0]
 
 
 
 
 
== <code>rgbToHEX</code> ==
 
Convert RGB list value to hex string.
 
 
 
'''Signature'''
 
String rgbToHEX(List RGB)
 
 
 
'''Parameters'''
 
 
 
RGB - Red, Green, Blue (valid values are 0..255)
 
 
 
'''Returns'''
 
 
 
String - The RGB value of the integer list encoded as a hex string.
 
 
 
'''Example'''
 
log.debug hubitat.helper.ColorUtils.rgbToHEX([126,255,0]) == "#7EFF00"
 
 
 
== <code>rgbToHSV</code> ==
 
Convert RGB list values to Hue, Saturation and Level list
 
 
 
'''Signature'''
 
List rgbToHSV(List RGB)
 
 
 
'''Parameters'''
 
 
 
List - the rgb list to convert
 
 
 
'''Returns'''
 
 
 
List - Hue, Saturation and Level
 
 
 
'''Example'''
 
log.debug hubitat.helper.ColorUtils.rgbToHSV([126,255,0]) == [25.1, 100.0, 100.0]
 
 
 
 
 
== <code>hsvToRGB</code> ==
 
Convert Hue, Saturation and Level list to rgb list
 
 
 
'''Signature'''
 
String hsvToRGB(List HSV)
 
 
 
'''Parameters'''
 
 
 
List - the hsv list to convert. (valid values are 0..100)
 
 
 
'''Returns'''
 
 
 
List - The HSV List returned as a list of rgb Integer values.
 
 
 
'''Example'''
 
log.debug hubitat.helper.ColorUtils.hsvToRGB([25.1, 100.0, 100.0]) == [126, 255, 0]
 

Latest revision as of 03:55, 25 September 2022

We're moving! Please visit http://docs2.hubitat.com for the latest documentation.

This document is available at: http://docs2.hubitat.com/en/developer/colorutils-object