AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
Color typedict
 
A Color object represents a color by specifying the intensities of the three primary colors. The fields in a Color are:
blue A Number that specifies the intensity of the blue component as a double in the range 0.0 to 1.0 or an int in the range 0 to 255.
green A Number that specifies the intensity of the green component as a double in the range 0.0 to 1.0 or an int in the range 0 to 255.
red A Number that specifies the intensity of the red component as a double in the range 0.0 to 1.0 or an int in the range 0 to 255.
An intensity of zero represents no contribution from the component, while an intensity of 1.0 in the case of a double or 255 in the case of an int represents the maximum contribution from that component. Setting all three components to zero represents black, while setting them all to their maximum value represents white. The color represents a shade of gray if the three components are numerically equal and have the same type.
 
 Example:   The program,
import yoix.*.*;

int n;

Frame f = {
    Array layout = {
        new Label {
            String tag = "$_name";
            String font = "Lucida-bold-14";
            Color  background = Color.lightGray;
            Color  foreground = Color.black;
            int    alignment = CENTER;
        }, NORTH,
    };
};

f.visible = TRUE;

for (n = 0; n < Color@length; n++) {
    f.background = Color[n];
    f.components.$_name.text = Color[n]@nameof;
    sleep(2);
}

exit(0);
slowly changes the background color assigned to a frame to all the colors defined in the yoix.awt.Color dictionary and shows the name of each selected color in the label that is positioned at the top of the frame.
 
 See Also:   addColor, getBrighterColor, getCMYKColor, getDarkerColor, getHSBColor, getRGBColor

 

Yoix is a registered trademark of AT&T Inc.