View Single Post
Old 05-19-2018, 07:40 PM   #28
wrCisco
Enthusiast
wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.wrCisco ought to be getting tired of karma fortunes by now.
 
Posts: 43
Karma: 588278
Join Date: Apr 2016
Device: none
Yes, that seems to be a bug in cssutils that does a case sensitive match with 'rgb(', 'rgba(' and relatives, while it should be ASCII case insensitive.
I'll file a bug report to cssutils.

In the meantime the workaround is, as suggested by Doitsu, to use only lowercase characters for color functions.

(I think that the patch in cssutils should be something like this...
In cssutils/css/value.py, in method _setCssText of class ColorValue:
Code:
noalp = Sequence(Prod(name='FUNCTION',
                      match=lambda t, v: t == types.FUNCTION and
                                              v in ('rgb(', 'hsl('),
...
witha = Sequence(Prod(name='FUNCTION',
                      match=lambda t, v: t == types.FUNCTION and
                                              v in ('rgba(', 'hsla('),
should become:
Code:
noalp = Sequence(Prod(name='FUNCTION',
                      match=lambda t, v: t == types.FUNCTION and
                                              v.lower() in ('rgb(', 'hsl('),
...
witha = Sequence(Prod(name='FUNCTION',
                      match=lambda t, v: t == types.FUNCTION and
                                              v.lower() in ('rgba(', 'hsla('),
).

Thanks for the bug report!
wrCisco is offline   Reply With Quote