CMYK values as background Color

user1641519 picture user1641519 · Sep 7, 2012 · Viewed 10.4k times · Source

I have to set backgroundColor of div using RGB values . Im able to get this way.

<div style="width: 100px; height: 100px; background-color: rgb(255,0,0)">
</div>

Now, Since I also have CMYK (0,1,0.5,0) values , So Can you assist me how to achieve same with these values.

Im doing this way , but no gain .

<div style="width: 100px; height: 100px; background-color: device-cmyk(0, 1, 0.5, 0)">
</div>

Thanks

Answer

Arash Shahkar picture Arash Shahkar · Sep 7, 2012

You can't do it directly in CSS. You'll have to convert your CMYK values to their RGB counterparts somewhere else (probably by a server-side script) and use the converted values in your CSS. Note that converting is not actually much different to what the SVG function does.