-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: color variable #2867
feat: color variable #2867
Conversation
I feel it might be helpful to add a text example of the possible usages without values. Eg, I find it very unclear what |
@dennisrijsdijk thats in the description. |
The string parsing is very permissive. It is meant to make typing a color as input as easy as possible. All commas, percentages, parenthesis are optional, and most input allow either 0-1, 0%-100%, or 0-n (where n is either 100, 255, or 360 depending on the value). HSL and HSV both require either 0%-100% or 0-1 for the S/L/V properties. The H (hue) can have values between 0%-100% or 0-360. RGB input requires either 0-255 or 0%-100%. Here are some examples of string input: Hex, 8-digit (RGBA) Hexcolor["#000"] RGB, RGBAcolor["rgb (255, 0, 0)"] HSL, HSLAcolor["hsl(0, 100%, 50%)"] HSV, HSVAcolor["hsv(0, 100%, 100%)"] NamedCase insenstive names are accepted, using the list of colors in the CSS spec. color["RED"] the output is selected by specifying the type in the second parameter the alpha is controlled by the third parameter |
Is the "needs review" tag saying that this is still in testing? I'm not going to merge until everything is good. |
This requires testing from Elgato lights and Philips Hue before merge |
Elgato Strip lights and Phillips Hue got changed. we can move this into v5 but I would like someone with the hardware confirm that I did not break anything. |
Description of the Change
adds color variable with conversion to and from all easy to convert formats
hsl to hex
hex to hsl
color name to any
rgb
hsv
examples:
there are many more things that can be done with this
turning RGB to hex 'color[RGB(255, 0, 0)]' returns ff0000ff
Applicable Issues
#2076
Testing
I have had and used this in a script for a very long time I am adding it to the code base at the request of @dennisrijsdijk
I use this to control my WiZ lights color from chat, my clock color, and my clouds, the clouds are in hsl and the clock is in hsv
the WiZ lights are in hsv as well but everything else is in hex8 formats.
I now need someone with Elgato Strip lights and Phillips Hue to test this.
Screenshots