Probably color profiles, but very annoying, and faced with a customer who types in capital letters…
I draw a filled rectangle on screen using RGB(153,194,84)
I display a color picker, I set that to be 153,194,84
It shows the same green.
I open a web-based RGB color picker and enter the same values.
Green. Different green!
I grab the 3 of them at once, then I use the eyedropper to select the color from each in turn.
The Green in my Xojo app is about 10% lighter than the web based one.
And when I use the eyedropper on the green sample in the web based selector, it is the correct RGB values.
I am utterly confused and a bit annoyed that what I ask for is not what gets displayed, when a web page can do it properly.
This suggests it is not a profile thing, but a Xojo thing.
Whats going wrong?
You will need to convert your color into the correct color space for macOS I use mbs function
Protected Function CorrectSRGB(c as Color) As color
return NSColorMBS.colorWithSRGB(c.Red / 255,c.Green / 255, c.Blue / 255,1 - c.Alpha / 255).colorValue
And it renders the correct colors to the screen
What screen do you have? If it has a p3 gamut then it has more than 8 bits per pixel and 0-255 can’t cover all the options. Internally apple uses fractions from 0-1. <https://xojo.com/issue/66810> has a similar feel to the issue. Likely around the way that 0-255 is mapped to values in the range 0-1.
Ok, I will give that a try
I’m pretty sure its a colour management issue.
The standard colour space on the web is sRGB or P3 for wide gamut. Xojo uses DeviceRGB on macOS (sRGB on MS-Windows).
If you are using the macOS colour palette colour picker then the icon next to the colour mode popup (circle with 3 dots) will show you the colour space of the picked colour and allow you to convert the colour to a different colour space.
Personally, I prefer to use the Digital Colour Meter utility for finding colours as you can specify up front which colour space you want to view them in.
That solution seems to work for me, thank you!
(I have a similar issue with displaying bitmaps brought from Windows machines, but that seems to suggest I would need to have something to apply as a blanket to
.drawpicture in a canvas paint event
I’ll look about, but if you already know the answer to that I would be even happier!)
Bitmaps on mac and windows is a lot more complex. You will need to convert from the embedded profile or a fixed profile, eg sRGB, into the correct output profile. This will be the screens assigned color profile. mbs has all the functions to get this to work. I have spent a long time trying to get this all to work and it is a nightmare. NSScreenMBS has the color space information and CSProfileMBS can create them off the ICCprofileData. Loading images embedded color profile is also done with MBS using one of the picture loading classes. Or you could load using macOS api class, CGImage etc.
If all your images are in the same colorspace then you can store the ICCData as a constant and load it and use it as the source color profile for all your conversions.
Unfortunately I don’t have a nice module i can share as this code has evolved over 14 years and is a mess.
I am basing all of this off a quick look at the the color profile management code I have and it might be a different workflow now as well.
If i also remember correctly on macOS you correct to the main screens profile and if rendering onto a mirrored screen it would do the conversion for you, windows you had to correct for each different screen.