Predefined colors in colors.h

Hi there :wave: a complete newbie to ProffieOS (and lightsabers in general tbh). I just got my first one the other day, actually, tbh, I got two as I couldn’t decide !

Anyway, on to the question. While diving into learning how they work and to configure them, I found that In styles/colors.h there are some define colors, and their RGB values don’t match up what you find when you look up color names and their RGB values elsewhere, is there a reason for that?

Example, with DodgerBlue, but found this with multiple color names.

DodgerBlue RGB found on both wikipedia and color-name.com has these values;
Dodgerblue HEX #1E90FF / RGB (30, 144, 255)

But the color definition in ProffieOS is;
Dodgerblue HEX #0248FF / RGB(2, 72, 255)

Eg.
typedef Rgb<2, 72, 255> DodgerBlue;

The likely values are factored for LED shine thru a translucent blade with a diffuser. As the diffuser and blade are white the red and green values are dropped to accommodate for that. This way we end up with at least a common value close to the desired color within Proffie. You can always edit the values on the line codes or even add in custom values within the colors.h

ProffieOS uses linear transfer functions for colors, not sRGB transfer functions.
Transforming from sRGB to ProffieOS colors is basically done as follows:

ProffieColor = 255 * (\frac{sRGB}{255})^{2.2}

As for why:

  • linear colors blend better
  • PWM-driven LEDs have linear response

One drawback of linear colors is that they have poor precision for low values. The fix for that is to use Rgb16<> since proffieos uses 16-bits per channel for all color calculations.

Great, thanks for the explanation :slight_smile:

Was going to test some colors, so It’s good to know. So if I find a colors sRGB values and run through the equation I should get the desired color output on the blade?
And using Rgb16<> for dim colors?

You can use RGB16 all the time, that’s what the style editor does, the formula would just be:

ProffieColor16 = 65535 * (\frac{sRGB}{255})^{2.2}

Also personally I like to have my lightsaber colors as bright and saturated as possible, that’s why all the default colors are on the edge of the color wheel. Another way to state this is that one of the RGB values should always be the max, one should always be zero, and the third should be somewhere in between. However, not everybody agrees with this philosophy.

(The style editor has a button in the color section that brings up a color picker, and then calculates the Rgb16<> values for you, so maybe use that?)

I tend to agree on the bright colors, I’m mostly interested in testing variations of blue/green/yellow (red can just stay red :smiley: ).

Using the color picker in the style editor is a great tip! Thanks! I can paste in sRGB hex codes to have it generate the Rgb16<> values.

It’s also really helpful with trying to understand how styles are built etc, using the examples and also copy-ing styles from Fett263’s style library to see layers/args/default values…

Again, thanks for the explanations and help. I did not expect to go diving into these configs wen I ordered my saber(s) but it’s super fun to learn.