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

Bug #298528 reported by Kjell Magne Fauske on 2008-11-15
2
Affects Status Importance Assigned to Milestone
Inkscape
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.

Kjell Magne Fauske (kjellmf) wrote :
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) on 2011-09-01
Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Low
milestone: none → 0.49
status: New → In Progress
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
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) on 2012-02-15
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers