Loading ...
Sorry, an error occurred while loading the content.

Re: [svg-developers] "Named colors" revisited

Expand Messages
  • Erik Dahlström
    ... SVG 1.2 Tiny allows this, see the spec[1] (and if you scroll down a bit from there, there s even a complete example of how to use it). In a
    Message 1 of 5 , Sep 5, 2008
    • 0 Attachment
      On Thu, 04 Sep 2008 13:20:06 +0200, markdyson.13441 <mdyson@...> wrote:

      > This is a follow-up to a question I asked several weeks ago.
      > Apologies for the delay, I had medical issues.
      >
      > The question was whether SVG supported name aliases for color
      > definition, and I was shown there is indeed an existing list of such
      > named colors. I think what I'm driving at goes a bit deeper; an
      > example might be best.

      SVG 1.2 Tiny allows this, see the spec[1] (and if you scroll down a bit from there, there's even a complete example of how to use it).

      In a <solidColor> element you can set the 'solid-color' attribute to whatever color you need using the normal svg syntax for colors, and by giving the <solidColor> element an id you can reference this as a paintserver, just like a gradient, e.g url(#mycolor).

      Opera 9.5 supports this, if you are looking for something to test in.

      > In the GeoSym standard, when the various attributes of a feature are
      > looked up and evaluated to select a final portrayal image, the color
      > of that image is defined by a specific name; that name has to be used
      > as is, or else somehow translated from GeoSym into something that SVG
      > can understand. Further, the same color name will refer to one of two
      > different RGB values, depending on whether the feature is being viewed
      > under day or night conditions.

      It's possible to animate the solid-color attribute, does that solve your problem?

      > My question, my understanding of the underpinnings of SVG being as
      > weak as it is, can this color definition method be supported within
      > SVG itself, or must the colors first be translated into RGB values
      > externally and fed to SVG?

      Depends if the colors are defined in svg already or not, see the <color> syntax[2].

      Hope this helps
      /Erik

      [1] http://dev.w3.org/SVG/profiles/1.2T/publish/painting.html#SolidColorElement
      [2] http://dev.w3.org/SVG/profiles/1.2T/publish/types.html#DataTypeColor

      --
      Erik Dahlstrom, Core Technology Developer, Opera Software
      Co-Chair, W3C SVG Working Group
      Personal blog: http://my.opera.com/macdev_ed
    • Frank Bruder
      ... bit from there, there s even a complete example of how to use it). ... whatever color you need using the normal svg syntax for colors, and by giving the
      Message 2 of 5 , Sep 5, 2008
      • 0 Attachment
        --- In svg-developers@yahoogroups.com, Erik Dahlström <ed@...> wrote:
        >
        > On Thu, 04 Sep 2008 13:20:06 +0200, markdyson.13441 <mdyson@...> wrote:
        >
        > > This is a follow-up to a question I asked several weeks ago.
        > > Apologies for the delay, I had medical issues.
        > >
        > > The question was whether SVG supported name aliases for color
        > > definition, and I was shown there is indeed an existing list of such
        > > named colors. I think what I'm driving at goes a bit deeper; an
        > > example might be best.
        >
        > SVG 1.2 Tiny allows this, see the spec[1] (and if you scroll down a
        bit from there, there's even a complete example of how to use it).
        >
        > In a <solidColor> element you can set the 'solid-color' attribute to
        whatever color you need using the normal svg syntax for colors, and by
        giving the <solidColor> element an id you can reference this as a
        paintserver, just like a gradient, e.g url(#mycolor).
        >

        Actually, <solidColor> defines a paint server, which, strictly
        speaking, is not the same as a color keyword. You can reference a
        paint server in the fill and stroke properties of a shape element. But
        color keywords can also be used in a gradient as the stop-color of a
        stop element. This is a place where you need to specify a color and a
        paint server is not an allowed value.

        On another note, it's possible to use a gradient with just one color
        for the whole range as a substitute for <solidColor>. This wouldn't
        require an SVG 1.2 viewer.


        Regards
        Frank
      • Erik Dahlström
        ... Thanks, I ve raised this as an issue for a future SVG spec revision [1]. If there s further feedback on this topic, please post to the www-svg@w3.org list
        Message 3 of 5 , Sep 8, 2008
        • 0 Attachment
          On Fri, 05 Sep 2008 19:15:31 +0200, Frank Bruder <redurbf@...> wrote:

          > --- In svg-developers@yahoogroups.com, Erik Dahlström <ed@...> wrote:
          >>
          >> On Thu, 04 Sep 2008 13:20:06 +0200, markdyson.13441 <mdyson@...> wrote:
          >>
          >> > This is a follow-up to a question I asked several weeks ago.
          >> > Apologies for the delay, I had medical issues.
          >> >
          >> > The question was whether SVG supported name aliases for color
          >> > definition, and I was shown there is indeed an existing list of such
          >> > named colors. I think what I'm driving at goes a bit deeper; an
          >> > example might be best.
          >>
          >> SVG 1.2 Tiny allows this, see the spec[1] (and if you scroll down a
          > bit from there, there's even a complete example of how to use it).
          >>
          >> In a <solidColor> element you can set the 'solid-color' attribute to
          > whatever color you need using the normal svg syntax for colors, and by
          > giving the <solidColor> element an id you can reference this as a
          > paintserver, just like a gradient, e.g url(#mycolor).
          >>
          >
          > Actually, <solidColor> defines a paint server, which, strictly
          > speaking, is not the same as a color keyword. You can reference a
          > paint server in the fill and stroke properties of a shape element. But
          > color keywords can also be used in a gradient as the stop-color of a
          > stop element. This is a place where you need to specify a color and a
          > paint server is not an allowed value.
          >
          > On another note, it's possible to use a gradient with just one color
          > for the whole range as a substitute for <solidColor>. This wouldn't
          > require an SVG 1.2 viewer.

          Thanks, I've raised this as an issue for a future SVG spec revision [1].

          If there's further feedback on this topic, please post to the www-svg@... list and put "ISSUE-2047" in the mail body or subject line.

          Cheers
          /Erik

          [1] http://www.w3.org/Graphics/SVG/WG/track/issues/2047


          --
          Erik Dahlstrom, Core Technology Developer, Opera Software
          Co-Chair, W3C SVG Working Group
          Personal blog: http://my.opera.com/macdev_ed
        Your message has been successfully submitted and would be delivered to recipients shortly.