Font color in :content prawn

1.2k views Asked by At

I've got this line of code:

{:content => product.description.capitalize, :inline_format => true}

I would like to change the font color. I've tried:

{:content => product.description.capitalize, :color => :red, :inline_format => true}

and:

{:content => product.description.capitalize, :font_color => :red, :inline_format => true}

But these don't work. How can I do that?

2

There are 2 answers

1
rick On

Try with 'text_color' ,

{:content => product.description.capitalize, :text_color => "#ff0000", :inline_format => true}
0
Martin T. On

The best answer is inside the comment from Jakub!

use :inline_format => true to allow the use of <color rgb='009ddf'> ... </color> inside the text. Together with <b>...</b> for bold and <u>...</u>, for underline <i>..</i> for italic you can format the text inline.