[reportlab-users] Buglet and fix in HexColor (2.6 and probably before)

Tim Roberts timr at probo.com
Thu Jan 17 13:18:21 EST 2013


Dinu Gherman wrote:

> I noticed a bug in reportlab.lib.colors.HexColor when actually using the

> alpha parameter, e.g.:

>

> In [1]: from reportlab.lib.colors import HexColor

> In [2]: HexColor(16777215, alpha=0.5)


The "alpha" parameter is just a Boolean that identifies whether or not
alpha is present in the first parameter. So, to get the effect you
asked for, you'd want:
HexColor( 0x80ffffff, alpha=True )

The root of the problem is one missing set of parens around the
(val>>24)&0xff term, which your patch adequately corrects.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list