Forum How do I...?

print in grayscale

fbrzvnrnd
Hi,

I usually print Prince PDF file using CMYK colors in CSS. Now I have to print a black and white book (no colors). There are some grey texts on it. What is the right way to handle greyscale in CSS?
mikeday
There is no way to specify grayscale colors in CSS, but Prince will convert RGB grays to grayscale colorspace automatically, eg. rgb(92,92,92) will become gray(92).
fbrzvnrnd
And what about something like:

color:rgba(0,0,0,0.5);
mikeday
That will be gray(0) with opacity(0.5), eg. semi-transparent black, which is a different beast from gray, although ends up looking much the same in practice. :)
fbrzvnrnd
Thank you for the answer: do you know where can I find a reliable "rgb grays" table?
mikeday
In our case it is simply all the sRGB colors with three equal components, from rgb(0,0,0) to rgb(255,255,255). Do you have source images in a particular grayscale colorspace?
fbrzvnrnd
:facepalm:

I never realized that rgb(x,x,x) is grey. Thank you.