parseColor() in simplestyle.py can't parse colors of type rgb(xx.x%,xx.x%,xx.xx%)

Bug #298528 reported by Kjell Magne Fauske
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Kjell Magne Fauske

Bug Description

The parseColor() function in simplestyle.py can't parse valid color expressions like:

parseColor('rgb(66.667%,0%,6.667%)')
parseColor('currentColor')
parsecolor('ActiveBorder')

I have attached a patch that fixes the first problem. I have also attached unit tests that verifies it.

For the two other color types there is no straightforward solution since resolving the color code requires knowledge of the environment. A workaround is to return a default color, but it is not an ideal solution.

Revision history for this message
Kjell Magne Fauske (kjellmf) wrote :
Revision history for this message
Kjell Magne Fauske (kjellmf) wrote :
Revision history for this message
Kjell Magne Fauske (kjellmf) wrote :

I have attached a patch that return a default color (black) in cases where the color is unknown. Not sure if this is the best approach, but it is probably better than raising an exception.

tags: added: extensions-plugins
removed: extensions
jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Low
milestone: none → 0.49
status: New → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Fix committed in the trunk, revision 10610.
Thanks for the patches and the test file (committed as well in the test directory).

As you noticed in the bug description, currentColor and ActiveBorder are very difficult to parse here. I'm going to close the reoort because it fixes what can be fixed with numerical values. Feel free to open a different report for the remaining issues.

Changed in inkscape:
assignee: JazzyNico (jazzynico) → Kjell Magne Fauske (kjellmf)
status: In Progress → Fix Committed
tags: added: backport-proposed color styles
removed: python
Revision history for this message
jazzynico (jazzynico) wrote :

Back-ported to the 0.48.x branch, revision 9830.

tags: removed: backport-proposed
Changed in inkscape:
milestone: 0.49 → 0.48.3
Ted Gould (ted)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.