Using Random, Custom, Colors for RGB Bulbs?


#1

1) Give a description of the problem
Disclaimer: I’ve been using WebCoRE for a week and am not a developer. I have 4 exterior RGB bulbs and setup a piston so that when a virtual switch is turned on, these bulbs randomly rotate between the colors of my teams (Chiefs, SKC, Jayhawks). Ideally, I’d like to use the specific team colors (found here: https://teamcolorcodes.com/). However, I cannot figure out how to use custom colors in the random expression. Any ideas?

No pride of authorship here, so please let me know if there is a better way to accomplish this.

2) What is the expected behaviour?
When virtual switch is toggled, light bulbs randomly change every x - y seconds to one of 2-3 custom colors

3) What is happening/not happening?
I am unable to figure out how to combine the random function with custom colors

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
Haven’t gotten this far


#2

I just did a bit of preliminary data gathering…


Kansas City Chiefs

Red
Hex Color: #E31837;
RGB: (227,24,55)

Gold
Hex Code: #FFB81C;
RGB: (255,184,28)


Sporting Kansas City

Sporting Blue
Hex Color: #93B1D7;
RGB: (147, 177, 215)

Dark Indigo
Hex Color: #002A5C;
RGB: (0, 42, 92)

Lead
Hex Color: #a0a1a5;
RGB: (160,161,165)


Kansas Jayhawks

KU Blue
Hex Color: #0051BA;
RGB: (0, 81, 186)

Crimson
Hex Color: #E8000D;
RGB: (232, 0, 13)

Jayhawk Yellow
Hex Color: #ffc82d;
RGB: (255,200,45)

Signature Grey
Hex Color: #85898a;
RGB: (133,137,138)


Do you really want all 9 colors intermingling?


#3

I don’t - I’ll have different pistons for each team. I’m struggling to use a color like “Lead” as it is not a preset color. Do you know of a way to use the Hex Color or RGB values instead?


#4

Yes. That was my next suggestion… To actually test out the conversion to see if you are happy with a specific color. Here is a sample command for testing Chief’s red using “Hex” (my preferred method):

pic

You can save this little snippet, and press Test to see the results.
(Import code: “k44i”)


For reference, you can also try RGB using:


Note: The bulb’s color may not match identically…

Once you are happy with a group of colors, it should be easy to implement random factors.
(especially if you are satisfied with the hex code)


#5

Thanks for the help - i’m going to test out the fix when i get home. I think my ignorance kept me from realizing “red” gets double quotes and ‘#E31837’ gets single quotes. I was trying to do the hex code with double quotes.


#6

Honestly, either single or double quotes will work if you are in the Expression box…
(just be consistent)