rio icon indicating copy to clipboard operation
rio copied to clipboard

rio set color value without color conversion

Open tsssni opened this issue 1 year ago • 1 comments

The color gamut of my MacBook's display is Display P3. I tried to set the background color of rio to match Xcode with the value of #1F1F24, but I found through the Display Color Meter that rio directly set the Display P3 value without color space conversion.

Xcode background color

Screenshot 2024-08-08 at 18 17 05 Screenshot 2024-08-08 at 18 18 17

Rio background color

Screenshot 2024-08-08 at 18 21 10 Screenshot 2024-08-08 at 18 21 25

tsssni avatar Aug 08 '24 10:08 tsssni

Hey @tsssni thanks for the issue!

hmm, very interesting. Rio follow this conversion: https://github.com/raphamorim/rio/blob/main/rio-backend/src/config/colors/mod.rs#L425-L473

fn decode_hex(s: &str) -> Result<Vec<u8>, ParseIntError> {
    (0..s.len())
        .step_by(2)
        .map(|i| u8::from_str_radix(&s[i..i + 2], 16))
        .collect()
}
Hex #FFFFFF

sRGB   0-255 =  255.000  255.000  255.000
sRGB   0-1.0 =  1.00000  1.00000  1.00000
RGB Adobe 98 =  255.000  255.000  255.000

raphamorim avatar Aug 10 '24 09:08 raphamorim