字体颜色:内容对虾

时间:2015-06-11 07:29:46

标签: ruby-on-rails prawn

我有这行代码:

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

我想更改字体颜色。我试过了:

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

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

但这些都不起作用。我怎么能这样做?

2 个答案:

答案 0 :(得分:2)

尝试使用' text_color' ,

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

答案 1 :(得分:0)

最好的答案是来自雅库布的评论!

使用:inline_format => true允许在文本内部使用<color rgb='009ddf'> ... </color>。与<b>...</b>(用于粗体)和<u>...</u>(用于下划线<i>..</i>(用于斜体))一起可以设置文本的内联格式。