Development Team/Almanac/Making Icons: Difference between revisions

Erik B (talk | contribs)
Srevin03 (talk | contribs)
Replace old sugariconify.py with new version from sugarlabs
Tag: visualeditor-switched
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{TOCright}}
Save yourself some time. Don't make the mistake I made. Before you make an icon, see if it's already on the laptop!
Save yourself some time. Don't make the mistake I made. Before you make an icon, see if it's already on the laptop!


Line 35: Line 33:


Kidscape aka inkscape child friendly version(olpc): https://bugs.launchpad.net/inkscape/+bug/170488 please cc yourself to this bug, and comment as appropriate.
Kidscape aka inkscape child friendly version(olpc): https://bugs.launchpad.net/inkscape/+bug/170488 please cc yourself to this bug, and comment as appropriate.
There is also the start of a vector icon-drawing activity at http://dev.laptop.org/git/users/cscott/icon-draw-activity/ -- please adopt it and finish it off!


====Templates====
====Templates====
Line 76: Line 76:
===The Script===
===The Script===


In order to streamline the process of creating sugar compatible icons, we provide the [[olpc:media: sugar-iconify.py | sugar-iconify]] script.  This script takes an SVG file as input and outputs a new SVG (or SVGs) containing the proper entity definitions.  It offers a number of command-line flags for performing variations on this process to fit smoothly into your workflow.  You can view all of the available options by running <tt>sugar-iconify -h</tt> from the command line, or by viewing the dedicated [[olpc:Sugar-iconify | usage page]].  Some specific examples and use cases are illustrated below in more detail.
In order to streamline the process of creating sugar compatible icons, we provide the [https://github.com/sugarlabs/sugariconify/blob/master/sugariconify.py sugariconify] script.  This script takes an SVG file as input and outputs a new SVG (or SVGs) containing the proper entity definitions.  It offers a number of command-line flags for performing variations on this process to fit smoothly into your workflow.  You can view all of the available options by running <tt>sugariconify -h</tt> from the command line, or by viewing the dedicated [[Sugar iconify | usage page]].  Some specific examples and use cases are illustrated below in more detail.


=====Download=====
=====Download=====


* [[OLPC:media: sugar-iconify.py | sugar-iconify.py]]
* [https://github.com/sugarlabs/sugariconify/blob/master/sugariconify.py sugariconify.py]


===Basic Conversion===
===Basic Conversion===
Line 141: Line 141:
== Using gradients ==
== Using gradients ==


''Is there a way to render gradients using the fill color?  For example, if the child's XO fill color is red, I would like to render an activity icon using a red gradient.''
Here is an example of one way to do this by overlaying a gradient over the data-driven XO stroke and fill colors:


Here is an example of one way to do this by overlaying a gradient over the data-driven XO stroke and fill colors:
<pre><nowiki>
<nowiki>


<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
Line 181: Line 180:
</g>
</g>
</svg>
</svg>
</nowiki>
</nowiki></pre>
 
The "stop-color" properties of an SVG gradient will also accept the &stroke_color; and &fill_color; entities, if you want a gradient in the user's colors.  For example, this shows two gradients between transparent and opaque versions of the child's stroke and fill colors:
 
<pre><nowiki>
<?xml version="1.0" ?><!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
<!ENTITY stroke_color "#666">
<!ENTITY fill_color "#fff">
]><svg xmlns="http://www.w3.org/2000/svg" version="1.1"
      height="55px" width="55px" viewBox="0 0 55 55" x="0px">
<defs>
  <radialGradient cx="29.547" cy="27.726" gradientUnits="userSpaceOnUse" id="radialGradient3776" r="16.875">
  <stop offset="0" stop-color="&fill_color;"/>
  <stop offset="1" stop-color="&fill_color;" stop-opacity="0"/>
  </radialGradient>
  <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient3784" x1="12.672" x2="46.422" y1="27.726" y2="27.726">
  <stop offset="0" stop-color="&stroke_color;"/>
  <stop offset="1" stop-color="&stroke_color;" stop-opacity="0"/>
  </linearGradient>
</defs>
<path d="m45.204,27.726a15.657,15.657,0,1,1,-31.315,0,15.657,15.657,0,1,1,31.315,0z" fill="url(#radialGradient3776)" stroke="url(#linearGradient3784)" stroke-dasharray="none" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="4" stroke-width="2.43559003" transform="matrix(1.4370235,0,0,1.4370235,-14.959677,-12.342744)"/>
</svg>
</nowiki></pre>


== See also ==
== See also ==
Line 191: Line 212:
[[Category:Design]]
[[Category:Design]]
[[Category:Graphic Design]]
[[Category:Graphic Design]]
[[Category:Sugar LI]]