tools: post-process SVG objects with "color-important" label.
This will allow a designer to simply "tag" an object so that its color
does not get overrided by GTK+ without needing to edit the file as text.
(cherry picked from commit 8a36b786bc
)
This commit is contained in:
@ -47,7 +47,7 @@ fi
|
|||||||
|
|
||||||
# Extract the icon code.
|
# Extract the icon code.
|
||||||
#icon=`xmllint "$source" --xpath '//*[local-name()="g" and @id="'$id'"]'`
|
#icon=`xmllint "$source" --xpath '//*[local-name()="g" and @id="'$id'"]'`
|
||||||
icon=`xmllint "$source" --xpath '//*[@id="'$id'"]'`
|
icon=`xmllint "$source" --xpath '//*[@id="'$id'"]' --noblanks`
|
||||||
# Get rid of any transform on the top node to help librsvg.
|
# Get rid of any transform on the top node to help librsvg.
|
||||||
#icon=`echo $icon | sed 's/^\(<[^>]*\) transform="[^"]*"/\1/'`
|
#icon=`echo $icon | sed 's/^\(<[^>]*\) transform="[^"]*"/\1/'`
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -55,6 +55,10 @@ if [ $? -ne 0 ]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
# Add !important to any object with label "color-important".
|
||||||
|
icon=`echo $icon | sed 's/<\([^<>]*\)style="\([^"]*\)fill:\([^;"]*\)\([^"]*\)"\([^<>]*\)inkscape:label="color-important"\([^>]*\)>/<\1style="\2fill:\3 !important\4"\5\6>/'`
|
||||||
|
icon=`echo $icon | sed 's/<\([^<>]*\)inkscape:label="color-important"\([^>]*\)style="\([^"]*\)fill:\([^;"]*\)\([^"]*\)"\([^<>]*\)>/<\1\2style="\3fill:\4 !important\5"\6>/'`
|
||||||
|
|
||||||
# The typical namespaces declared at start of a SVG made with Inkscape.
|
# The typical namespaces declared at start of a SVG made with Inkscape.
|
||||||
# Since we are not sure of what namespace will use the object XML, and
|
# Since we are not sure of what namespace will use the object XML, and
|
||||||
# since we don't want to end up with invalid XML, we just keep them all
|
# since we don't want to end up with invalid XML, we just keep them all
|
||||||
|
Reference in New Issue
Block a user