[Sugar-devel] xo colors & gradients

Erik Blankinship erikb at mediamods.com
Mon Aug 23 15:46:31 EDT 2010


On Mon, Aug 23, 2010 at 3:14 PM, Walter Bender <walter.bender at gmail.com>wrote:

> On Mon, Aug 23, 2010 at 1:52 PM, Erik Blankinship <erikb at mediamods.com>
> wrote:
> > When I launch an activity, the SVG icon used to display my activity
> changes
> > appearance by rendering with the XO colors.
> > (1) 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.  Maybe there are tricks in SVG which make this
> > possible?
>
> SVG does have a gradient you can use. I use them in the Turtle Art
> blocks. For example,
>
> <defs>
>    <linearGradient id="linearGradient1234">
>        <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" />
>        <stop style="stop-color:#000000;stop-opacity:1;" offset="1" />
>    </linearGradient>
>    <linearGradient
>        xlink:href="#linearGradient1234"
>        id="linearGradient5678"
>        x1="0"
>        y1="100 "
>        x2="200"
>        y2="300"
>        gradientUnits="userSpaceOnUse" />
> </defs>
>
> later,
>
> fill = "url(#linearGradient5678)"
>
>
Thank you, it is helpful to see how gradients can be used in SVG.

How would I specify that I want to sugar to use the XO color to create a
gradient from the XO fill color when my activity is running?  As I
understand it, sugar activity icons can expect stroke_color and fill_color
to be provided when an activity is launched:

<!ENTITY stroke_color "#010101">
<!ENTITY fill_color "#FFFFFF">

Given one of these colors, it would like to calculate the stop-colors in
your example.

Can I do this calculation in SVG?  Can my activity somehow pass this
information to the SVG renderer when it is launched?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100823/4ba3ed7e/attachment.htm 


More information about the Sugar-devel mailing list