0

If I do something like: <div style={{color: 'rgb(0,0,0)'}}>blah</div> it works fine

while <div style={{color: 'cmyk(0.58, 0.19, 0, 0.22)'}}>blah</div>

just gets left out of the generated DOM altogether.

So does react not support CMYK colours or am I doing something wrong?

Note that I am only using CMYK for mathematical convenience - I am converting an array of 8bytes into a colour for visual effect like so:

const colour = {
    c: Math.round(( (gbytes[0]/0xFFFF)+(gbytes[1]/0xFFFF) ) / 2 * 100, 1) / 100,
    m: Math.round(( (gbytes[2]/0xFFFF)+(gbytes[3]/0xFFFF) ) / 2 * 100, 1) / 100,
    y: Math.round(( (gbytes[4]/0xFFFF)+(gbytes[5]/0xFFFF) ) / 2 * 100, 1) / 100,
    k: Math.round(( (gbytes[5]/0xFFFF)+(gbytes[6]/0xFFFF) ) / 2 * 100, 1) / 100,
};
user1456632
  • 638
  • 6
  • 17
  • CMYK isn't supported in CSS. It's in the CSS4 Working draft: https://www.w3.org/TR/css-color-4/#cmyk-colors – disinfor Nov 04 '20 at 19:32
  • Ah :( that's a shame - no sense adding another layer of math then, I should just find a way of representing 8 bytes as rgb instead – user1456632 Nov 04 '20 at 19:33

0 Answers0