[reportlab-users] how to register a color at runtime in order to use it with <font color="my_cd_color1">my text</font>
Roberto Alsina
ralsina at netmanagers.com.ar
Thu Mar 25 08:56:43 EDT 2010
On Thursday 25 March 2010 09:49:25 Thomas Kremmel wrote:
> 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.
Since noone ever will see that markup, why not use #rrggbb ?
More information about the reportlab-users
mailing list