[Sugar-devel] xo colors & gradients

Bert Freudenberg bert at freudenbergs.de
Mon Aug 23 16:46:28 EDT 2010


Use the entities. E.g. replace #ffffff with &stroke_color;

Just look at the source of any activity icon.

- Bert -


On 23.08.2010, at 22:03, Erik Blankinship wrote:

> rephrased: How would I specify that I want sugar to use an XO color to create a gradient when my activity is running?
> 
> On Mon, Aug 23, 2010 at 3:46 PM, Erik Blankinship <erikb at mediamods.com> wrote:
> 
> 
> 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?
> 
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100823/4bc78e69/attachment.htm 


More information about the Sugar-devel mailing list