There's a strange thing happening with the colour when used as HEX vs computed.
For instance I have this THEME colour 0xfffb3984, from which I obtain the HIGHLIGHT colour 0xFFFF85B4 after applying some saturation and brightness (using Hise stock methods)
I can confirm the HEX obtained using a colorPicker on a panel I painted with.
briefly:
const var THEME = 0xfffb3984;
const var HIGHLIGHT = getColourFromTheme(0.48, 1.0); // sat + bright -> 0xFFFF85B4
But from here it makes no sense:
-
If I use the variable in a paint routine as HIGHLIGHT, no problemo, it's the good one.
-
Now if I programmatically set a colour property of some components using HIGHLIGHT, essentially the preset browser floating tile, the resulting colour displayed is absolutely different (like green instead of pink)
While pasting directly the HEX equivalent works... (even if both methods show the same HEX in the property panel)
But this is not the case for other components like labels, for which if you either set the colour programmatically with the variable HIGHLIGHT or paste the HEX value, the result is the same, as expected
Ok... So the preset floating tile colour handling is broken and then what?
Well this is where things get interesting.
When printing the decimal equivalent, you get two different values despite a colourPicker giving the same HEX for both:
Console.print(0xFFFF85B4); // 4294935988
Console.print(HIGHLIGHT); // -31308
So my guess is that in the components that are working with either values (aka property set manually vs programatically), it might be because of some sanitisation behind the scene. While in the preset browser this sanitisation might simply not occur, so -31308 returns hise green instead of pink.
So the questions are:
- Why are the decimal results different, while a colour picker shows the exact same HEX? Are those decimals equivalent like when you make a full revolution around a trigonometric circle? (like 3 PI being equivalent to PI)
- Why, if a sanitisation is needed, it doesn't happen directly after the use of
Colours.withSaturation() and Colours.withBrightness()?
- Can we fix the preset browser floating tile colour handling?