cssutils
cssutils copied to clipboard
Hex Colors Being Shortened During parseString()
I was using cssutils to pull color data from a website and came across what I believe to be a bug.
Test Code:
test = ".auto-style5 { width: 250px; color: #FFFFFF; background-color: #000000; font-family: Arial, Helvetica, sans-serif; font-size: x-large; }"
css = cssutils.parseString(test)
for rule in css:
print(rule)
Result:
<cssutils.css.CSSStyleRule object selectorText='.auto-style5' style='width: 250px;\ncolor: #FFF;\nbackground-color: #000;\nfont-family: Arial, Helvetica, sans-serif;\nfont-size: x-large' _namespaces={} at 0x1063973a0>
color and background-color are shortened from #FFFFFF & #000000 to #FFF & #000 causing issues with my application.
I'm not familiar enough with hex codes. Are those codes equivalent?
Doing a quick search, I did determine that those color codes are equivalent (if only three hex digits are supplied, it's inferred that the other digit of the longer form is the same).
What sorts of issues does this cause with your application?