Working with Color Specifications

Various API's allow you to pass a 'color_spec_name' or 'color_value' to set a color. A 'color_spec_name' refers to a previously defined color. You can create and define different colors, and then refer to them by name. Alternatively, a 'color_value' allows you to directly specify which color you want.

color_value

color_value can be in one of the following forms:

  • 0xRRGGBBAA where RR,GG,BB refer to the hex values for the Red, Green, Blue colors and AA refers to the transparency color
  • 0xRRGGBB, same as above but without the transparency color
  • #RRGGBBAA, same as above but with a leading '#' instead of '0x' (web style).
  • #RRGGBB, same as above but with a leading '#' instead of '0x' (web style), no transparency
  • RRGGBBAA, same as above but without any leading characters
  • RRGGBB, same as above but without any leading characters or transparency
  • The specific color names White, Yellow, Fuchsia, Red, Silver, Gray, Olive, Purple, Maroon, Aqua, Lime, Teal, Green, Blue, Navy, Black, Cyan, Magenta, Transparent. Not case sensitive.

color_spec_name

You can define your own colors and then refer to them by name. First, use .COLOR INITIALIZE to create an empty color, using whatever name you want. Then you can use the .COLOR SET routines to set the RGB values, intensity, and other settings. You can then use this color_spec_name instead of a color_value.

This gives you a way to define something similar to 'styles'. You can write a subroutine that creates color specs for Text, Borders, Background, etc, and use those names on all your charts. To change the look of your charts, you just have to change the named color spec, and all charts that use that name will use the new color.

Comments:

Read what other users have said about this page or add your own comments.


-- JeanNeron - 2011-09-22

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2011-09-22 - JeanNeron
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback