swatch

Color swatch for RGB color selection and display

Description

The 2-dimensional colorspace of the swatch object represents hue along the horizontal axis, and luminance along the vertical axis. a third color-dimension, saturation, may be set by means of the saturation message.

Arguments

None.

Messages

bang A bang message causes output of the RGBA values of the current color at the selected (x,y) position on the 2-dimensional colorspace, taking into account the current saturation value.
int Red-Value (0 through 255) [int]
In left inlet: A number between 0 and 255 sets the red color component and triggers RGBA output.

Note: Unlike most Max objects, input to any one of the three inlets will re-calculate the current color location on the swatch, and trigger output.
  (inlet1) Green-Value (0 through 255) [int]
In middle inlet: A number between 0 and 255 sets the green color component and triggers RGBA output.

Note: Unlike most Max objects, input to any one of the three inlets will re-calculate the current color location on the swatch, and trigger output.
  (inlet2) Blue-Value (0 through 255) [int]
In right inlet: A number between 0 and 255 sets the blue color component and triggers RGBA output.

Note: Unlike most Max objects, input to any one of the three inlets will re-calculate the current RGBA color location on the swatch, and trigger output.
float Red-Value (0 through 255) [float]
Converted to int.
  (inlet1) Green-Value (0 through 255) [float]
Converted to int.
  (inlet2) Blue-Value (0 through 255) [float]
Converted to int.
list RGB-list (0 through 255) [list]
A list of three numbers between 0 and 255 sets the three RGB color components (red, green, blue), refreshes the display and causes RGBA output.
alpha opacity-value (0 through 255) [float]
The word alpha, followed by a floating-point number between 0 and 255, will set the RGBA alpha (opacity) value.
hsl hue (0 through 255) saturation (0 through 255) and luminance (0 through 255) [list]
The word hsl, followed by a list of three numbers between 0 and 255, sets the color based on the given hue (x-axis), saturation, and luminance (y-axis) values. The swatch object converts these values to RGBA color values, refreshes the display, and causes output of the RGBA values.
(mouse) Clicking and dragging on the swatch object will calculate and output the RGBA color at the selected (x, y) position on the 2-dimensional (hue-luminance) colorspace, taking into account the current saturation value.
saturation color-saturation (0 through 255) [float]
The word saturation, followed by a number between 0 and 255 will change the color saturation of the displayed 2-dimensional (hue, lightness) colorspace. It will also re-calculate the new RGBA color at the selected (x, y) position and cause output.
set RGB-list (0 through 255) [list]
The word set, followed by a list of three numbers between 0 and 255 sets the three RGB color components (red, green, blue) and refreshes the display without causing RGBA output.
sethsl hue (0 through 255) saturation (0 through 255) and luminance (0 through 255) [list]
The word sethsl, followed by a list of three numbers between 0 and 255, sets the color based on the given hue (x-axis), saturation, and luminance (y-axis) values and the refreshes the display. Unlike the hsl message the sethsl message does not output the corresponding RGBA values.

Attributes

Name Type g/s Description
compatibility int
def.:0
Toggles the output of the suckah object in old-style integer values in the range 0-255 (0) or Max 5 0.-1.0 floating-point values (1).

Information for box attributes common to all objects

Output

int: Out right outlet: the current saturation value (calculated from an RGB list input, or output directly after a saturation message)
list: Out left outlet: a list of three RGB (red, green, blue) color values

Examples

See Also

Name Description
colorpicker Select a color using a modal dialog
panel Colored background area
Max JS Tutorial 3: JavaScript Tasks, Arguments, and Globals Max JS Tutorial 3: JavaScript Tasks, Arguments, and Globals