You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Jeremias Maerki <de...@jeremias-maerki.ch> on 2010/06/15 20:02:25 UTC

Thinking about color

Folks,
if you haven't seen it, yet, I've started to write down some notes on
handling color on the Wiki which applies to both Batik and FOP:
http://wiki.apache.org/xmlgraphics/ColorHandling

This is mostly triggered by my wanting to add support for named colors
in SVG and FO. I'm grateful for feedback from anyone who knows a few
things about colors. I'm especially hoping for Thomas to chime in since
her works for a color-phile company. ;-)

Discussion on general@ please.

Thanks,
Jeremias Maerki


Re: Thinking about color

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Yes, I could use feedback from people with advanced knowledge of color
issues. I'm still learning and only trying to become a color expert.

As for your comment, I can't tell why lightbrown should cause trouble.
It's just a simple named sRGB color which is mapped to predefined R, G
and B values. FOP actually implements SVG's list of colors, not just the
ones from CSS: http://www.w3.org/TR/SVG11/types.html#ColorKeywords

On 15.06.2010 20:26:00 Eric Douglas wrote:
> Maybe I'm not quite sure what you're getting at, maybe it takes a color
> expert?  All I know is I tried using names for those colors and ran into
> a couple of issues.
> For one it didn't seem to like the brown, but of course I wanted to make
> it more dynamic to compute colors for the possibility of many pie
> pieces, but here's what I started with.
> 
>           <xsl:when test="$i=1">orangered</xsl:when>
>           <xsl:when test="$i=2">cornflowerblue</xsl:when>
>           <xsl:when test="$i=3">yellow</xsl:when>
>           <xsl:when test="$i=4">lightgreen</xsl:when>
>           <xsl:when test="$i=5">blueviolet</xsl:when>
>           <xsl:when test="$i=6">chartreuse</xsl:when>
>           <xsl:when test="$i=7">deepskyblue</xsl:when>
> ** for some reason light brown causes extreme delay on output create
>           <xsl:when test="$i=8">lightbrown</xsl:when>
>           <xsl:when test="$i=9">aquamarine</xsl:when>
>           <xsl:when test="$i=10">pink</xsl:when>
>           <xsl:when test="$i=11">cornflowerblue</xsl:when>
>           <xsl:when test="$i=12">lightyellow</xsl:when>
>           <xsl:when test="$i=13">burlywood</xsl:when>
>           <xsl:when test="$i=14">cornflowerblue</xsl:when>
>           <xsl:when test="$i=15">cornsilk</xsl:when>
>           <xsl:otherwise>black</xsl:otherwise> 
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Tuesday, June 15, 2010 2:20 PM
> To: general@xmlgraphics.apache.org
> Subject: Re: Thinking about color
> 
> Thanks, Eric. Actually, I'm talking about more than just sRGB which is
> already sufficiently implemented in both Batik and FOP. What I'm trying
> to cover are device-specific colors, CIE-family colors and foremost
> named colors (spot colors).
> 
> On 15.06.2010 20:12:57 Eric Douglas wrote:
> > Color works fine for me in FOP.
> > I looked up default color names on the web and found these weird 
> > things, from cornflowerblue to burlywood.
> > I just use a value of RGB(#,#,#) on the fill attribute in the svg
> tags.
> > Of course being a programmer I prefer to use the numbers to calculate 
> > the colors rather than putting in goofy names.
> > I copied some SVG code for a pie chart from some web page and replaced
> 
> > the color section (attempting to make the color of each slice 
> > distinguishable from the next) with:
> >           <xsl:when test="$i=1">rgb(255,127,127)</xsl:when>
> >           <xsl:when test="$i=2">rgb(127,127,255)</xsl:when>
> >           <xsl:when test="$i=3">rgb(255,255,127)</xsl:when>
> >           <xsl:when test="$i=4">rgb(191,64,255)</xsl:when>
> >           <xsl:when test="$i=5">rgb(127,255,127)</xsl:when>
> >           <xsl:when test="$i=6">rgb(255,191,64)</xsl:when>
> >           <xsl:when test="$i=7">rgb(223,95,191)</xsl:when>
> >           <xsl:when test="$i=8">rgb(127,191,191)</xsl:when>
> >           <xsl:when test="$i=9">rgb(255,223,32)</xsl:when>
> >           <xsl:when test="$i=10">rgb(159,95,255)</xsl:when>
> >           <xsl:when test="$i=11">rgb(191,255,127)</xsl:when>
> >           <xsl:when test="$i=12">rgb(255,223,95)</xsl:when>
> >           <xsl:when test="$i=13">rgb(239,111,223)</xsl:when>
> >           <xsl:when test="$i=14">rgb(127,159,223)</xsl:when>
> >           <xsl:when test="$i=15">rgb(255,239,79)</xsl:when>
> >           <xsl:otherwise><xsl:value-of 
> > select="concat('rgb(',string(255
> > - (($i - 15) * 32)),',',string(255 - (($i - 15) * 32)),',',string(255 
> > - (($i - 15) * 32)),')')"/></xsl:otherwise>
> > 
> > -----Original Message-----
> > From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> > Sent: Tuesday, June 15, 2010 2:02 PM
> > To: batik-dev@xmlgraphics.apache.org; fop-dev@xmlgraphics.apache.org; 
> > general@xmlgraphics.apache.org
> > Subject: Thinking about color
> > 
> > Folks,
> > if you haven't seen it, yet, I've started to write down some notes on 
> > handling color on the Wiki which applies to both Batik and FOP:
> > http://wiki.apache.org/xmlgraphics/ColorHandling
> > 
> > This is mostly triggered by my wanting to add support for named colors
> 
> > in SVG and FO. I'm grateful for feedback from anyone who knows a few 
> > things about colors. I'm especially hoping for Thomas to chime in 
> > since her works for a color-phile company. ;-)
> > 
> > Discussion on general@ please.
> > 
> > Thanks,
> > Jeremias Maerki
> > 
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: general-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: general-help@xmlgraphics.apache.org
> 




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


RE: Thinking about color

Posted by Eric Douglas <ed...@blockhouse.com>.
Maybe I'm not quite sure what you're getting at, maybe it takes a color
expert?  All I know is I tried using names for those colors and ran into
a couple of issues.
For one it didn't seem to like the brown, but of course I wanted to make
it more dynamic to compute colors for the possibility of many pie
pieces, but here's what I started with.

          <xsl:when test="$i=1">orangered</xsl:when>
          <xsl:when test="$i=2">cornflowerblue</xsl:when>
          <xsl:when test="$i=3">yellow</xsl:when>
          <xsl:when test="$i=4">lightgreen</xsl:when>
          <xsl:when test="$i=5">blueviolet</xsl:when>
          <xsl:when test="$i=6">chartreuse</xsl:when>
          <xsl:when test="$i=7">deepskyblue</xsl:when>
** for some reason light brown causes extreme delay on output create
          <xsl:when test="$i=8">lightbrown</xsl:when>
          <xsl:when test="$i=9">aquamarine</xsl:when>
          <xsl:when test="$i=10">pink</xsl:when>
          <xsl:when test="$i=11">cornflowerblue</xsl:when>
          <xsl:when test="$i=12">lightyellow</xsl:when>
          <xsl:when test="$i=13">burlywood</xsl:when>
          <xsl:when test="$i=14">cornflowerblue</xsl:when>
          <xsl:when test="$i=15">cornsilk</xsl:when>
          <xsl:otherwise>black</xsl:otherwise> 

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Tuesday, June 15, 2010 2:20 PM
To: general@xmlgraphics.apache.org
Subject: Re: Thinking about color

Thanks, Eric. Actually, I'm talking about more than just sRGB which is
already sufficiently implemented in both Batik and FOP. What I'm trying
to cover are device-specific colors, CIE-family colors and foremost
named colors (spot colors).

On 15.06.2010 20:12:57 Eric Douglas wrote:
> Color works fine for me in FOP.
> I looked up default color names on the web and found these weird 
> things, from cornflowerblue to burlywood.
> I just use a value of RGB(#,#,#) on the fill attribute in the svg
tags.
> Of course being a programmer I prefer to use the numbers to calculate 
> the colors rather than putting in goofy names.
> I copied some SVG code for a pie chart from some web page and replaced

> the color section (attempting to make the color of each slice 
> distinguishable from the next) with:
>           <xsl:when test="$i=1">rgb(255,127,127)</xsl:when>
>           <xsl:when test="$i=2">rgb(127,127,255)</xsl:when>
>           <xsl:when test="$i=3">rgb(255,255,127)</xsl:when>
>           <xsl:when test="$i=4">rgb(191,64,255)</xsl:when>
>           <xsl:when test="$i=5">rgb(127,255,127)</xsl:when>
>           <xsl:when test="$i=6">rgb(255,191,64)</xsl:when>
>           <xsl:when test="$i=7">rgb(223,95,191)</xsl:when>
>           <xsl:when test="$i=8">rgb(127,191,191)</xsl:when>
>           <xsl:when test="$i=9">rgb(255,223,32)</xsl:when>
>           <xsl:when test="$i=10">rgb(159,95,255)</xsl:when>
>           <xsl:when test="$i=11">rgb(191,255,127)</xsl:when>
>           <xsl:when test="$i=12">rgb(255,223,95)</xsl:when>
>           <xsl:when test="$i=13">rgb(239,111,223)</xsl:when>
>           <xsl:when test="$i=14">rgb(127,159,223)</xsl:when>
>           <xsl:when test="$i=15">rgb(255,239,79)</xsl:when>
>           <xsl:otherwise><xsl:value-of 
> select="concat('rgb(',string(255
> - (($i - 15) * 32)),',',string(255 - (($i - 15) * 32)),',',string(255 
> - (($i - 15) * 32)),')')"/></xsl:otherwise>
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch]
> Sent: Tuesday, June 15, 2010 2:02 PM
> To: batik-dev@xmlgraphics.apache.org; fop-dev@xmlgraphics.apache.org; 
> general@xmlgraphics.apache.org
> Subject: Thinking about color
> 
> Folks,
> if you haven't seen it, yet, I've started to write down some notes on 
> handling color on the Wiki which applies to both Batik and FOP:
> http://wiki.apache.org/xmlgraphics/ColorHandling
> 
> This is mostly triggered by my wanting to add support for named colors

> in SVG and FO. I'm grateful for feedback from anyone who knows a few 
> things about colors. I'm especially hoping for Thomas to chime in 
> since her works for a color-phile company. ;-)
> 
> Discussion on general@ please.
> 
> Thanks,
> Jeremias Maerki
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: Thinking about color

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Thanks, Eric. Actually, I'm talking about more than just sRGB which is
already sufficiently implemented in both Batik and FOP. What I'm trying
to cover are device-specific colors, CIE-family colors and foremost
named colors (spot colors).

On 15.06.2010 20:12:57 Eric Douglas wrote:
> Color works fine for me in FOP.
> I looked up default color names on the web and found these weird things,
> from cornflowerblue to burlywood.
> I just use a value of RGB(#,#,#) on the fill attribute in the svg tags.
> Of course being a programmer I prefer to use the numbers to calculate
> the colors rather than putting in goofy names.
> I copied some SVG code for a pie chart from some web page and replaced
> the color section (attempting to make the color of each slice
> distinguishable from the next) with:
>           <xsl:when test="$i=1">rgb(255,127,127)</xsl:when>
>           <xsl:when test="$i=2">rgb(127,127,255)</xsl:when>
>           <xsl:when test="$i=3">rgb(255,255,127)</xsl:when>
>           <xsl:when test="$i=4">rgb(191,64,255)</xsl:when>
>           <xsl:when test="$i=5">rgb(127,255,127)</xsl:when>
>           <xsl:when test="$i=6">rgb(255,191,64)</xsl:when>
>           <xsl:when test="$i=7">rgb(223,95,191)</xsl:when>
>           <xsl:when test="$i=8">rgb(127,191,191)</xsl:when>
>           <xsl:when test="$i=9">rgb(255,223,32)</xsl:when>
>           <xsl:when test="$i=10">rgb(159,95,255)</xsl:when>
>           <xsl:when test="$i=11">rgb(191,255,127)</xsl:when>
>           <xsl:when test="$i=12">rgb(255,223,95)</xsl:when>
>           <xsl:when test="$i=13">rgb(239,111,223)</xsl:when>
>           <xsl:when test="$i=14">rgb(127,159,223)</xsl:when>
>           <xsl:when test="$i=15">rgb(255,239,79)</xsl:when>
>           <xsl:otherwise><xsl:value-of select="concat('rgb(',string(255
> - (($i - 15) * 32)),',',string(255 - (($i - 15) * 32)),',',string(255 -
> (($i - 15) * 32)),')')"/></xsl:otherwise>
> 
> -----Original Message-----
> From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Sent: Tuesday, June 15, 2010 2:02 PM
> To: batik-dev@xmlgraphics.apache.org; fop-dev@xmlgraphics.apache.org;
> general@xmlgraphics.apache.org
> Subject: Thinking about color
> 
> Folks,
> if you haven't seen it, yet, I've started to write down some notes on
> handling color on the Wiki which applies to both Batik and FOP:
> http://wiki.apache.org/xmlgraphics/ColorHandling
> 
> This is mostly triggered by my wanting to add support for named colors
> in SVG and FO. I'm grateful for feedback from anyone who knows a few
> things about colors. I'm especially hoping for Thomas to chime in since
> her works for a color-phile company. ;-)
> 
> Discussion on general@ please.
> 
> Thanks,
> Jeremias Maerki
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


RE: Thinking about color

Posted by Eric Douglas <ed...@blockhouse.com>.
Color works fine for me in FOP.
I looked up default color names on the web and found these weird things,
from cornflowerblue to burlywood.
I just use a value of RGB(#,#,#) on the fill attribute in the svg tags.
Of course being a programmer I prefer to use the numbers to calculate
the colors rather than putting in goofy names.
I copied some SVG code for a pie chart from some web page and replaced
the color section (attempting to make the color of each slice
distinguishable from the next) with:
          <xsl:when test="$i=1">rgb(255,127,127)</xsl:when>
          <xsl:when test="$i=2">rgb(127,127,255)</xsl:when>
          <xsl:when test="$i=3">rgb(255,255,127)</xsl:when>
          <xsl:when test="$i=4">rgb(191,64,255)</xsl:when>
          <xsl:when test="$i=5">rgb(127,255,127)</xsl:when>
          <xsl:when test="$i=6">rgb(255,191,64)</xsl:when>
          <xsl:when test="$i=7">rgb(223,95,191)</xsl:when>
          <xsl:when test="$i=8">rgb(127,191,191)</xsl:when>
          <xsl:when test="$i=9">rgb(255,223,32)</xsl:when>
          <xsl:when test="$i=10">rgb(159,95,255)</xsl:when>
          <xsl:when test="$i=11">rgb(191,255,127)</xsl:when>
          <xsl:when test="$i=12">rgb(255,223,95)</xsl:when>
          <xsl:when test="$i=13">rgb(239,111,223)</xsl:when>
          <xsl:when test="$i=14">rgb(127,159,223)</xsl:when>
          <xsl:when test="$i=15">rgb(255,239,79)</xsl:when>
          <xsl:otherwise><xsl:value-of select="concat('rgb(',string(255
- (($i - 15) * 32)),',',string(255 - (($i - 15) * 32)),',',string(255 -
(($i - 15) * 32)),')')"/></xsl:otherwise>

-----Original Message-----
From: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Sent: Tuesday, June 15, 2010 2:02 PM
To: batik-dev@xmlgraphics.apache.org; fop-dev@xmlgraphics.apache.org;
general@xmlgraphics.apache.org
Subject: Thinking about color

Folks,
if you haven't seen it, yet, I've started to write down some notes on
handling color on the Wiki which applies to both Batik and FOP:
http://wiki.apache.org/xmlgraphics/ColorHandling

This is mostly triggered by my wanting to add support for named colors
in SVG and FO. I'm grateful for feedback from anyone who knows a few
things about colors. I'm especially hoping for Thomas to chime in since
her works for a color-phile company. ;-)

Discussion on general@ please.

Thanks,
Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: Thinking about color

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hi Thomas

Thanks a lot for your reply!

On 18.06.2010 12:49:35 thomas.deweese wrote:
> Hi Jeremias,
> 
> Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 06/15/2010 02:02:25 PM:
> 
> > if you haven't seen it, yet, I've started to write down some notes on
> > handling color on the Wiki which applies to both Batik and FOP:
> > http://wiki.apache.org/xmlgraphics/ColorHandling
> 
>         I don't have a lot to say about the actual implementation, and I
> think you did a good job of pointing out the major issues.  I would 
> like to emphasize a few points.  First I think the ability to provide
> multiple (ordered) fallbacks would be extremely useful in a print
> context.  In the context of a document targeting a specific output it's
> not so useful, but for things like Logo's (which companies get very
> picky about the spot colors of) I am certain that in lots of cases people
> would want to specify the sRGB (for screen), CMYK (for generic print) and
> probably a Pantone (or some similar named spot color), perhaps hexachrome
> etc...

I think choosing the right color for a certain context is probably the
output handler's job and is probably dependent on configuration if we
ever want to go that far. In that sense, I think the simple list should
suffice.

>         Second I think the most important feature of the implementation is
> that it should make it easy to carry the extra color names through the
> processing.  Ideally it would also avoid 'rasterizing' those colors until
> absolutely necessary (i.e. for gradients, etc).  I'll say that avoiding
> rasterization is in general _really_ hard (and often doesn't actually buy
> you anything at the end), so it may not be worth it.

Right. If the target format supports named colors, for example, they
should be carried through if in any way possible. Only if thing like SVG
filters need to be applied, another color variant needs to be chosen.
But at any rate, people picky about spot colors will avoid the case
where that happens. ;-)

>         On Tints I think the intention in SVG was to use opacity.  It 
> think
> this is a decent way to handle it and I think it simplifies the color 
> stuff
> a bit (a spot color maps to one sRGB color).  Obviously you could view it 
> as
> an opaque color as well, but I think I like modeling it as opacity.

That's about what Chris Lilley suggested on the www-svg@w3.org list. I
guess that makes most sense. Still, commercial FO implementations
support it in their proprietary color extensions so we might support it,
too, in FOP at least, since we don't have transparency support in XSL-FO.

>         Another related issue (more for SVG than FOP perhaps) is the color 
> space
> that rendering operations should take place in.  SVG 1.2 had a new 
> property
> "rendering-color-space":
>         
> http://www.w3.org/TR/2004/WD-SVG12-20040318/#controlling-color-space

I guess that's going to be a tough one.

>         This was primarily intended for extended photographic color 
> spaces,
> so I'm not certain how useful it would be for print contexts.
> 
> > I'm especially hoping for Thomas to chime in since
> > her works for a color-phile company. ;-)
>   ^^^ -> he ;)

Sorry, a typo. My fingers are often faster than my eyes. ;-)

>         I hope the above helps.

Absolutely, and I appreciate it.

I'll continue along the lines outlined in the Wiki and probably create a
little branch for XGC until I've got it fully working. I will then
move on to FOP and finally to Batik. Feedback along the way is always
welcome.

Thanks,
Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org


Re: Thinking about color

Posted by th...@kodak.com.
Hi Jeremias,

Jeremias Maerki <de...@jeremias-maerki.ch> wrote on 06/15/2010 02:02:25 PM:

> if you haven't seen it, yet, I've started to write down some notes on
> handling color on the Wiki which applies to both Batik and FOP:
> http://wiki.apache.org/xmlgraphics/ColorHandling

        I don't have a lot to say about the actual implementation, and I
think you did a good job of pointing out the major issues.  I would 
like to emphasize a few points.  First I think the ability to provide
multiple (ordered) fallbacks would be extremely useful in a print
context.  In the context of a document targeting a specific output it's
not so useful, but for things like Logo's (which companies get very
picky about the spot colors of) I am certain that in lots of cases people
would want to specify the sRGB (for screen), CMYK (for generic print) and
probably a Pantone (or some similar named spot color), perhaps hexachrome
etc...

        Second I think the most important feature of the implementation is
that it should make it easy to carry the extra color names through the
processing.  Ideally it would also avoid 'rasterizing' those colors until
absolutely necessary (i.e. for gradients, etc).  I'll say that avoiding
rasterization is in general _really_ hard (and often doesn't actually buy
you anything at the end), so it may not be worth it.

        On Tints I think the intention in SVG was to use opacity.  It 
think
this is a decent way to handle it and I think it simplifies the color 
stuff
a bit (a spot color maps to one sRGB color).  Obviously you could view it 
as
an opaque color as well, but I think I like modeling it as opacity.

        Another related issue (more for SVG than FOP perhaps) is the color 
space
that rendering operations should take place in.  SVG 1.2 had a new 
property
"rendering-color-space":
        
http://www.w3.org/TR/2004/WD-SVG12-20040318/#controlling-color-space

        This was primarily intended for extended photographic color 
spaces,
so I'm not certain how useful it would be for print contexts.

> I'm especially hoping for Thomas to chime in since
> her works for a color-phile company. ;-)
  ^^^ -> he ;)

        I hope the above helps.