Class RGB

colormodel.RGB(r, g, b, a=255)

An instance is an RGB color value.

Constructor: creates a new RGB value (r,g,b,a).

param r:initial red value

Precondition: int between 0 and 255, inclusive.

param g:initial green value

Precondition: int between 0 and 255, inclusive.

param b:initial blue value

Precondition: int between 0 and 255, inclusive.

param a:initial alpha value (default 255)

Precondition: int between 0 and 255, inclusive.

The alpha channel is 255 by default, unless otherwise specified.

Attributes

red

The red channel.

Invariant: Value must be an int between 0 and 255, inclusive.

green

The green channel.

Invariant: Value must be an int between 0 and 255, inclusive.

blue

The blue channel.

Invariant: Value must be an int between 0 and 255, inclusive.

alpha

The alpha channel.

Used for transparency effects (but not in this course).

Invariant: Value must be an int between 0 and 255, inclusive.

Methods

glColor()

Returns: 4 element list of the attributes in the range 0 to 1

This is a conversion of this object into a format that can be used in openGL graphics

Table Of Contents

Previous topic

Color Models

Next topic

Class HSV

This Page