[reportlab-users] RGBA Colors

Kevin D Smith Kevin.Smith at sixquickrun.com
Tue Nov 24 10:51:51 EST 2009


A little while ago I asked if there was a way to get RGBA colors (like
in CSS3) where the A component is an alpha value to set transparency.
While doing some searching last night, I realized that the svn version
of ReportLab already has alpha support; however, it didn't go quite as
far as I had hoped. Methods were added to the canvas to set the fill
and stroke opacity, which is nice, but if you are using Platypus, you
don't have access to them.

I messed around with the code a bit in textobject.py and colors.py to
add alpha arguments to all of the color methods as well as an alpha
component to rgb and cmyk colors. With the attached patch, you can
specify colors with an alpha value that can be used in Platypus or
anywhere else colors are used. I would like this patch to be
considered for official use so that I don't have to remember to add
this support for my projects. Does anyone know what that would take?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgba.patch
Type: application/octet-stream
Size: 16815 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20091124/7ee649a1/attachment-0001.obj>
-------------- next part --------------

Kevin D Smith
Kevin.Smith at sixquickrun.com





More information about the reportlab-users mailing list