Class ::tycho::Shades


Inherits: ::tycho::Object - Source File - Contents: destructor - public methods - public procs - public commons
A color class. Any object that needs a color can ask for a color object, and then query that object for color-related information, such as lighter and darker shades of that color.

This object is a classic example of the ``flyweight'' object paradigm, in which small objects are shared in order to avoid creating lots of them. In other words, only one instance of a Shades object exists for each distinct color.

Currently, this class is too simple. It needs to provide a better selection of colors (i.e. fewer but better colors) in a manner that is independent of the X color names.

FIXME: This class needs to be merged with Color.itcl,.


Destructor

destructor
The destructor of a color returns an error, because we never really want to delete colors. The error is an empty string, in the hope that whoever tried to delete the color object just ignores it. I expect this it totally bogus, and think maybe this should be fixed...

Public constructs

Public Methods

light
Return a color shade. In decreasing brightness, they are light, gloss, matt, and dark. In general, gloss and matt should be used for solid colors, while light and dark are really only for 3D shading effects.
gloss
matt
dark

Public Procs

new color
The procedure to use to create a color object. This check is an object of the requested color exists, and returns it if it does. Otherwise, it creates a new object.
colors
Return a list of the available colors.

Public Commons

colorobjects
An array of color objects, used to avoid duplicating objects.
defaultcolorobject
The default color object, returned when an invalid color is requested.
colornames background lightgrey grey darkgrey antiquewhite aquamarine azure bisque blue brown burlywood cadetblue chartreuse chocolate coral cornsilk cyan darkgoldenrod darkolivegreen darkorange darkorchid darkseagreen darkslategray deeppink deepskyblue dodgerblue firebrick gold goldenrod green honeydew hotpink indianred ivory khaki lavenderblush lemonchiffon lightblue lightcyan lightgoldenrod lightpink lightsalmon lightskyblue lightsteelblue lightyellow magenta maroon mediumorchid mediumpurple mistyrose navajowhite olivedrab orange orangered orchid palegreen paleturquoise palevioletred peachpuff pink plum purple red rosybrown royalblue salmon seagreen seashell sienna skyblue slateblue slategray snow springgreen steelblue tan thistle tomato turquoise violetred wheat yellow
Legal colors. First line are manufactured shades of grey, other lines are color shades found using showrgb. These should probably be found dynamically.

Index of classes



Author: H. John Reekie
Version: @(#)Shades.itcl 1.6 12/09/96
Copyright: (c) 1996 The Regents of the University of California.