Recent

Author Topic: BGRASVGTheme  (Read 2433 times)

mike_p

  • New Member
  • *
  • Posts: 28
BGRASVGTheme
« on: August 21, 2024, 03:12:17 pm »
I'v be just been having a little play with the BGRASVGTheme and a BGRAThemeButton.

I like them!

But it would be really nice if the default Button normal SVG string didn't have a load of inkscape 'bloat'.

For example the current SVG is :

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <svg   xmlns:dc="http://purl.org/dc/elements/1.1/"   xmlns:cc="http://creativecommons.org/ns#"  
  3. xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   xmlns:svg="http://www.w3.org/2000/svg"  
  4. xmlns="http://www.w3.org/2000/svg"   xmlns:xlink="http://www.w3.org/1999/xlink"  
  5. xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"  
  6. xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"  
  7. width="32"   height="32"   viewBox="0 0 32 32"   version="1.1"   id="svg8"  
  8. inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"   sodipodi:docname="lime.svg">
  9.  <style     id="style833"></style>
  10.  <defs     id="defs2">  
  11.  <linearGradient       inkscape:collect="always"       id="linearGradient858">    
  12.  <stop         style="stop-color:#87cdde;stop-opacity:1"         offset="0"         id="stop854" />  
  13.    <stop         style="stop-color:#ffffff;stop-opacity:1"         offset="1"         id="stop856" />  
  14.   </linearGradient>  
  15.  <linearGradient       inkscape:collect="always"       xlink:href="#linearGradient858"    
  16.  id="linearGradient1415"       x1="3.9924731"       y1="5.9193549"    
  17.  x2="3.9924731"       y2="2.788172"       gradientUnits="userSpaceOnUse"    
  18.   gradientTransform="matrix(4.1517857,0,0,4.1517856,-1.5758928,-1.5758928)" />
  19.  </defs>
  20.   <sodipodi:namedview     id="base"     pagecolor="#ffffff"     bordercolor="#666666"     borderopacity="1.0"    
  21. inkscape:pageopacity="0.0"     inkscape:pageshadow="2"     inkscape:zoom="11.313708"  
  22.   inkscape:cx="4.3902273"     inkscape:cy="23.941929"     inkscape:document-units="px"    
  23. inkscape:current-layer="layer1"     inkscape:document-rotation="0"     showgrid="true"  
  24.  units="px"     inkscape:window-width="1920"     inkscape:window-height="1017"  
  25.   inkscape:window-x="-8"     inkscape:window-y="-8"     inkscape:window-maximized="1">
  26.    <inkscape:grid       type="xygrid"       id="grid837" />  </sodipodi:namedview>
  27.  <metadata     id="metadata5">  
  28.   <rdf:RDF>      <cc:Work         rdf:about="">
  29.        <dc:format>image/svg+xml</dc:format>    
  30.     <dc:type           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />  
  31.      <dc:title></dc:title>      </cc:Work>  
  32.   </rdf:RDF>  </metadata>  
  33. <g     inkscape:label="Capa 1"     inkscape:groupmode="layer"     id="layer1">
  34.    <path       vectorEffect="non-scaling-stroke"       id="rect835"
  35.      style="fill:url(#linearGradient1415);fill-opacity:1;stroke:#002255;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"  
  36.     d="M 9.8000004,0.50000004 H 22.2 c 5.1522,0 9.3,4.14779986 9.3,9.30000016 V 22.2 c 0,5.152199 -4.1478,9.3 -9.3,9.3 H 9.8000004 C 4.6478005,31.5 0.50000005,27.352199 0.50000005,22.2 V 9.8000002 c 0,-5.1522003 4.14780045,-9.30000016 9.30000035,-9.30000016 z" />
  37.  </g>
  38. </svg>
  39.  

I've written an equivalent which is much easier to read and adjust:
Code: XML  [Select][+][-]
  1. <svg  xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" version="1.1">
  2.   <defs>
  3.     <linearGradient id="Grad1" x1="0%" y1="0%" x2="0%" y2="100%">
  4.       <stop style="stop-color:#ffffff;stop-opacity:1" offset="30%"/>
  5.       <stop style="stop-color:#87cdde;stop-opacity:1" offset="70%"/>
  6.     </linearGradient>
  7.   </defs>
  8.   <g>
  9.     <path style="fill:url(#Grad1);fill-opacity:1;stroke:#002255;stroke-width:1;stroke-opacity:1"
  10.      d="m9.80,0.50h12.40c5.15,0.00 9.30,4.15 9.30,9.30v12.40c0.00,5.15-4.15,9.30-9.30,9.30h-12.40c-5.15, 0.00-9.30-4.15-9.30-9.30v-12.40c0.00-5.15 4.15-9.30 9.30-9.30z" />
  11.   </g>
  12. </svg>
  13.  
In this version all the extra inkscape/sodpodi tags, empty style tag, unused IDs are removed, the gradient is defined with percentages and has a single simple definition.

I'd also like to see more components using the themes - eg Panels Groupboxes etc.

paweld

  • Hero Member
  • *****
  • Posts: 1278
Re: BGRASVGTheme
« Reply #1 on: August 21, 2024, 03:33:29 pm »
Best regards / Pozdrawiam
paweld

mike_p

  • New Member
  • *
  • Posts: 28
Re: BGRASVGTheme
« Reply #2 on: August 22, 2024, 08:06:10 am »

lainz

  • Hero Member
  • *****
  • Posts: 4667
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: BGRASVGTheme
« Reply #3 on: August 23, 2024, 12:43:15 am »
Done in dev-bgracontrols, thanks for the new button code  :)

mike_p

  • New Member
  • *
  • Posts: 28
Re: BGRASVGTheme
« Reply #4 on: August 23, 2024, 07:29:47 am »
Done in dev-bgracontrols, thanks for the new button code  :)
Thank-you Lainz! That was a very impressive quick reaction!

 

TinyPortal © 2005-2018