Only convert color names to #RRGGBB if it will actually be shorter

This commit is contained in:
JSCHILL1 2009-08-01 07:23:24 -05:00
parent b16629795e
commit 9bec4cc4d0
5 changed files with 92 additions and 13 deletions

View file

@ -3,7 +3,7 @@
<linearGradient id="g1" x1="0" y1="0" x2="1" y2="0">
<stop offset="0.5" stop-color="rgb(50.0%, 0%, .0%)" />
</linearGradient>
<solidColor id="c1" solid-color="maroon"/>
<solidColor id="c1" solid-color="lightgoldenrodyellow"/>
</defs>
<rect id="rect" width="100" height="100" fill="rgb(15,16,17)" stroke="darkgrey" />
<circle id="circle" cx="100" cy="100" r="30" fill="url(#g1)" stroke="url(#c1)" />

Before

Width:  |  Height:  |  Size: 520 B

After

Width:  |  Height:  |  Size: 534 B

Before After
Before After

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="g1" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="red"/>
<stop offset="1" stop-color="blue"/>
</linearGradient>
<linearGradient id='g2' x1='0' y1='0' x2='1' y2='1'>
<stop offset='0' stop-color='red'/>
<stop offset='1' stop-color='blue'/>
</linearGradient>
<radialGradient xlink:href="#g1" id="g3" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1, 0, 0, 0.481529, -718.417, 98.7046)" cx="323.75433" cy="209.73672" fx="323.75433" fy="209.73672" r="6.2794499"/>
<radialGradient xlink:href="#g2" id="g4" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1, 0, 0, 0.481529, -718.417, 98.7046)" cx="323.75433" cy="209.73672" fx="323.75433" fy="209.73672" r="6.2794499"/>
<rect id="r1" fill="url(#g1)" width="100" height="100"/>
<rect id="r2" stroke="url(#g2)" width="100" height="100"/>
<rect id="r3" stroke="url(#g3)" width="100" height="100"/>
<rect id="r4" fill="url(#g4)" width="100" height="100"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB