boazsegev/combine_pdf

Most RGB colors don't work

chumakoff opened this issue · 1 comments

When I set RGB color for a font or a box using options such as :font_color and :box_color, in most cases white color is shown instead. Only some limited amount of colors is properly displayed in PDF.

For example, if I set font color font_color: [0, 0, 255] (blue) it is shown correctly.
But when I set this value font_color: [35, 72, 192] it shows white instead.

Hi @chumakoff ,

I understand your confusion as most RGB interfaces limit you to a 24bit color range where each color is in the 8 bit value range (0-255).

However, PDFs allow for floating point precision (which your display probably won't implement anyway). This means that the colors are in the range of 0-1, including all the infinite numbers in between.

You might find helpful examples in the README as well as the textbox method documentation where [0.5, 0.5, 0.5] is used for the color gray.

Good luck.