[reportlab-users] how to register a color at runtime in order to use it with <font color="my_cd_color1">my text</font>

Thomas Kremmel thomasspin at gmail.com
Thu Mar 25 08:49:25 EDT 2010


Hi,

I'm using XPreformatted to print pre formated paragraphs, like this:

invoice_subject_line_pre =
XPreformatted(smart_str(invoice_subject_line_rep),
invoice_subject_line_style)

In this paragraphs it is possible to define the size, color, etc.. via some
xml markups.

I'm using the following line to print some text in a different color.

<font color="my_cd_color1">my textt</font>

This does only work if reportlab does know the color "my_cd_color1". I'm
searching now a way how to register this color at runtime with reportlab.

Till now I just added it to the colors.py at line 556, which works fine but
is probably a very hackish approach.

reportlab\lib\colors.py insert at line 556
my_cd_color1 =HexColor("#b71234")

I searched for a way to do this and did not find one, but want to get rid of
this approach.

Thanks
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100325/f14844d8/attachment.html>


More information about the reportlab-users mailing list