Color


superclass: Object



Creation


Each component has a value from 0.0 to 1.0, except in new255.


*new(red, green,blue, alpha)

*new255(red, green,blue, alpha)

create new color in RGB mode. *new255 takes 8-bit values as arguments.


*fromArray(array)

create new color in RGB mode from a 3-4dim. array.


*hsv(hue, sat, val, alpha)

create new color in HSV mode.


*rand(hue, sat, val, alpha)

create new random color.


*black

create black.

*white

create white.

*clear

create translucent.

*red(val = 1.0, alpha = 1.0)

create red.

*green { arg val = 1.0, alpha = 1.0)

create green.

*yellow { arg val = 1.0, alpha = 1.0)

create yellow.

*blue { arg val = 1.0, alpha = 1.0)

create blue.


*grey(grey = 0.5, alpha = 1.0)

*gray(gray = 0.5, alpha = 1.0)

create gray/grey


Accessing


<>red

Get the red component.

Color.new(0.47, 0.94, 0.31, 1).red.postln;


<>green

Get the green component.

Color.new(0.47, 0.94, 0.31, 1).green.postln;


<>blue

Get the blue component.

Color.new(0.47, 0.94, 0.31, 1).blue.postln;


<>alpha

Get the alpha component.

Color.new(0.47, 0.94, 0.31, 1).alpha.postln;


<asHSV

returns an Array of [Hue, Sat, Val].

Color.rand.asHSV.postln;


<asArray

returns an Array of [R,G,B].

Color.rand.asArray.postln;

Manipulating


scaleByAlpha

uses the alpha-value to scale all other colorsParts; alpha then is 1.

blend(arg that, blend)

blends two Colors.

vary(val=0.1, lo=0.3, hi=0.9, alphaVal=0)

varies a Color.


GUI drawing


The following methods must be called within an SCWindow-drawHook or a SCUserView-drawFunc function, and will only be visible once the window or the view is refreshed. Each call to SCWindow-refresh SCUserView-refresh will 'overwrite' all previous drawing by executing the currently defined function.


See also: SCWindow, SCUserView, Pen and String


setStroke

sets the stroke color.

setFill

sets the fill color.

set

sets the stroke and the fill color.


(

w = SCWindow.new.front;

w.view.background_(Color.white);

w.drawHook = {

// set the Color

Pen.translate(200, 200);

30.do{

Pen.width = 3.0.rand;

Color.blue(rrand(0.0, 1), rrand(0.0, 0.5)).setStroke;

Color.red(rrand(0.0, 1), rrand(0.0, 0.5)).setFill;

Pen.addAnnularWedge(

0@0,

rrand(10, 50), 

rrand(51, 100), 

2pi.rand, 

2pi.rand

);

Pen.perform([\stroke, \fill].choose);

}

};

w.refresh;

)



X-windows colors :


    'alice blue' -> Color.new255(240, 248, 255),

    'AliceBlue' -> Color.new255(240, 248, 255),

    'antique white' -> Color.new255(250, 235, 215),

    'AntiqueWhite' -> Color.new255(250, 235, 215),

    'AntiqueWhite1' -> Color.new255(255, 239, 219),

    'AntiqueWhite2' -> Color.new255(238, 223, 204),

    'AntiqueWhite3' -> Color.new255(205, 192, 176),

    'AntiqueWhite4' -> Color.new255(139, 131, 120),

    'aquamarine' -> Color.new255(127, 255, 212),

    'aquamarine1' -> Color.new255(127, 255, 212),

    'aquamarine2' -> Color.new255(118, 238, 198),

    'aquamarine3' -> Color.new255(102, 205, 170),

    'aquamarine4' -> Color.new255(69, 139, 116),

    'azure' -> Color.new255(240, 255, 255),

    'azure1' -> Color.new255(240, 255, 255),

    'azure2' -> Color.new255(224, 238, 238),

    'azure3' -> Color.new255(193, 205, 205),

    'azure4' -> Color.new255(131, 139, 139),

    'beige' -> Color.new255(245, 245, 220),

    'bisque' -> Color.new255(255, 228, 196),

    'bisque1' -> Color.new255(255, 228, 196),

    'bisque2' -> Color.new255(238, 213, 183),

    'bisque3' -> Color.new255(205, 183, 158),

    'bisque4' -> Color.new255(139, 125, 107),

    'black' -> Color.new255(0, 0, 0),

    'blanched almond' -> Color.new255(255, 235, 205),

    'BlanchedAlmond' -> Color.new255(255, 235, 205),

    'blue' -> Color.new255(0, 0, 255),

    'blue violet' -> Color.new255(138, 43, 226),

    'blue1' -> Color.new255(0, 0, 255),

    'blue2' -> Color.new255(0, 0, 238),

    'blue3' -> Color.new255(0, 0, 205),

    'blue4' -> Color.new255(0, 0, 139),

    'BlueViolet' -> Color.new255(138, 43, 226),

    'brown' -> Color.new255(165, 42, 42),

    'brown1' -> Color.new255(255, 64, 64),

    'brown2' -> Color.new255(238, 59, 59),

    'brown3' -> Color.new255(205, 51, 51),

    'brown4' -> Color.new255(139, 35, 35),

    'burlywood' -> Color.new255(222, 184, 135),

    'burlywood1' -> Color.new255(255, 211, 155),

    'burlywood2' -> Color.new255(238, 197, 145),

    'burlywood3' -> Color.new255(205, 170, 125),

    'burlywood4' -> Color.new255(139, 115, 85),

    'cadet blue' -> Color.new255(95, 158, 160),

    'CadetBlue' -> Color.new255(95, 158, 160),

    'CadetBlue1' -> Color.new255(152, 245, 255),

    'CadetBlue2' -> Color.new255(142, 229, 238),

    'CadetBlue3' -> Color.new255(122, 197, 205),

    'CadetBlue4' -> Color.new255(83, 134, 139),

    'chartreuse' -> Color.new255(127, 255, 0),

    'chartreuse1' -> Color.new255(127, 255, 0),

    'chartreuse2' -> Color.new255(118, 238, 0),

    'chartreuse3' -> Color.new255(102, 205, 0),

    'chartreuse4' -> Color.new255(69, 139, 0),

    'chocolate' -> Color.new255(210, 105, 30),

    'chocolate1' -> Color.new255(255, 127, 36),

    'chocolate2' -> Color.new255(238, 118, 33),

    'chocolate3' -> Color.new255(205, 102, 29),

    'chocolate4' -> Color.new255(139, 69, 19),

    'coral' -> Color.new255(255, 127, 80),

    'coral1' -> Color.new255(255, 114, 86),

    'coral2' -> Color.new255(238, 106, 80),

    'coral3' -> Color.new255(205, 91, 69),

    'coral4' -> Color.new255(139, 62, 47),

    'cornflower blue' -> Color.new255(100, 149, 237),

    'CornflowerBlue' -> Color.new255(100, 149, 237),

    'cornsilk' -> Color.new255(255, 248, 220),

    'cornsilk1' -> Color.new255(255, 248, 220),

    'cornsilk2' -> Color.new255(238, 232, 205),

    'cornsilk3' -> Color.new255(205, 200, 177),

    'cornsilk4' -> Color.new255(139, 136, 120),

    'cyan' -> Color.new255(0, 255, 255),

    'cyan1' -> Color.new255(0, 255, 255),

    'cyan2' -> Color.new255(0, 238, 238),

    'cyan3' -> Color.new255(0, 205, 205),

    'cyan4' -> Color.new255(0, 139, 139),

    'dark goldenrod' -> Color.new255(184, 134, 11),

    'dark green' -> Color.new255(0, 100, 0),

    'dark khaki' -> Color.new255(189, 183, 107),

    'dark olive green' -> Color.new255(85, 107, 47),

    'dark orange' -> Color.new255(255, 140, 0),

    'dark orchid' -> Color.new255(153, 50, 204),

    'dark salmon' -> Color.new255(233, 150, 122),

    'dark sea green' -> Color.new255(143, 188, 143),

    'dark slate blue' -> Color.new255(72, 61, 139),

    'dark slate gray' -> Color.new255(47, 79, 79),

    'dark slate grey' -> Color.new255(47, 79, 79),

    'dark turquoise' -> Color.new255(0, 206, 209),

    'dark violet' -> Color.new255(148, 0, 211),

    'DarkGoldenrod' -> Color.new255(184, 134, 11),

    'DarkGoldenrod1' -> Color.new255(255, 185, 15),

    'DarkGoldenrod2' -> Color.new255(238, 173, 14),

    'DarkGoldenrod3' -> Color.new255(205, 149, 12),

    'DarkGoldenrod4' -> Color.new255(139, 101, 8),

    'DarkGreen' -> Color.new255(0, 100, 0),

    'DarkKhaki' -> Color.new255(189, 183, 107),

    'DarkOliveGreen' -> Color.new255(85, 107, 47),

    'DarkOliveGreen1' -> Color.new255(202, 255, 112),

    'DarkOliveGreen2' -> Color.new255(188, 238, 104),

    'DarkOliveGreen3' -> Color.new255(162, 205, 90),

    'DarkOliveGreen4' -> Color.new255(110, 139, 61),

    'DarkOrange' -> Color.new255(255, 140, 0),

    'DarkOrange1' -> Color.new255(255, 127, 0),

    'DarkOrange2' -> Color.new255(238, 118, 0),

    'DarkOrange3' -> Color.new255(205, 102, 0),

    'DarkOrange4' -> Color.new255(139, 69, 0),

    'DarkOrchid' -> Color.new255(153, 50, 204),

    'DarkOrchid1' -> Color.new255(191, 62, 255),

    'DarkOrchid2' -> Color.new255(178, 58, 238),

    'DarkOrchid3' -> Color.new255(154, 50, 205),

    'DarkOrchid4' -> Color.new255(104, 34, 139),

    'DarkSalmon' -> Color.new255(233, 150, 122),

    'DarkSeaGreen' -> Color.new255(143, 188, 143),

    'DarkSeaGreen1' -> Color.new255(193, 255, 193),

    'DarkSeaGreen2' -> Color.new255(180, 238, 180),

    'DarkSeaGreen3' -> Color.new255(155, 205, 155),

    'DarkSeaGreen4' -> Color.new255(105, 139, 105),

    'DarkSlateBlue' -> Color.new255(72, 61, 139),

    'DarkSlateGray' -> Color.new255(47, 79, 79),

    'DarkSlateGray1' -> Color.new255(151, 255, 255),

    'DarkSlateGray2' -> Color.new255(141, 238, 238),

    'DarkSlateGray3' -> Color.new255(121, 205, 205),

    'DarkSlateGray4' -> Color.new255(82, 139, 139),

    'DarkSlateGrey' -> Color.new255(47, 79, 79),

    'DarkTurquoise' -> Color.new255(0, 206, 209),

    'DarkViolet' -> Color.new255(148, 0, 211),

    'deep pink' -> Color.new255(255, 20, 147),

    'deep sky blue' -> Color.new255(0, 191, 255),

    'DeepPink' -> Color.new255(255, 20, 147),

    'DeepPink1' -> Color.new255(255, 20, 147),

    'DeepPink2' -> Color.new255(238, 18, 137),

    'DeepPink3' -> Color.new255(205, 16, 118),

    'DeepPink4' -> Color.new255(139, 10, 80),

    'DeepSkyBlue' -> Color.new255(0, 191, 255),

    'DeepSkyBlue1' -> Color.new255(0, 191, 255),

    'DeepSkyBlue2' -> Color.new255(0, 178, 238),

    'DeepSkyBlue3' -> Color.new255(0, 154, 205),

    'DeepSkyBlue4' -> Color.new255(0, 104, 139),

    'dim gray' -> Color.new255(105, 105, 105),

    'dim grey' -> Color.new255(105, 105, 105),

    'DimGray' -> Color.new255(105, 105, 105),

    'DimGrey' -> Color.new255(105, 105, 105),

    'dodger blue' -> Color.new255(30, 144, 255),

    'DodgerBlue' -> Color.new255(30, 144, 255),

    'DodgerBlue1' -> Color.new255(30, 144, 255),

    'DodgerBlue2' -> Color.new255(28, 134, 238),

    'DodgerBlue3' -> Color.new255(24, 116, 205),

    'DodgerBlue4' -> Color.new255(16, 78, 139),

    'firebrick' -> Color.new255(178, 34, 34),

    'firebrick1' -> Color.new255(255, 48, 48),

    'firebrick2' -> Color.new255(238, 44, 44),

    'firebrick3' -> Color.new255(205, 38, 38),

    'firebrick4' -> Color.new255(139, 26, 26),

    'floral white' -> Color.new255(255, 250, 240),

    'FloralWhite' -> Color.new255(255, 250, 240),

    'forest green' -> Color.new255(34, 139, 34),

    'ForestGreen' -> Color.new255(34, 139, 34),

    'gainsboro' -> Color.new255(220, 220, 220),

    'ghost white' -> Color.new255(248, 248, 255),

    'GhostWhite' -> Color.new255(248, 248, 255),

    'gold' -> Color.new255(255, 215, 0),

    'gold1' -> Color.new255(255, 215, 0),

    'gold2' -> Color.new255(238, 201, 0),

    'gold3' -> Color.new255(205, 173, 0),

    'gold4' -> Color.new255(139, 117, 0),

    'goldenrod' -> Color.new255(218, 165, 32),

    'goldenrod1' -> Color.new255(255, 193, 37),

    'goldenrod2' -> Color.new255(238, 180, 34),

    'goldenrod3' -> Color.new255(205, 155, 29),

    'goldenrod4' -> Color.new255(139, 105, 20),

    'gray' -> Color.new255(190, 190, 190),

    'gray0' -> Color.new255(0, 0, 0),

    'gray1' -> Color.new255(3, 3, 3),

    'gray10' -> Color.new255(26, 26, 26),

    'gray100' -> Color.new255(255, 255, 255),

    'gray11' -> Color.new255(28, 28, 28),

    'gray12' -> Color.new255(31, 31, 31),

    'gray13' -> Color.new255(33, 33, 33),

    'gray14' -> Color.new255(36, 36, 36),

    'gray15' -> Color.new255(38, 38, 38),

    'gray16' -> Color.new255(41, 41, 41),

    'gray17' -> Color.new255(43, 43, 43),

    'gray18' -> Color.new255(46, 46, 46),

    'gray19' -> Color.new255(48, 48, 48),

    'gray2' -> Color.new255(5, 5, 5),

    'gray20' -> Color.new255(51, 51, 51),

    'gray21' -> Color.new255(54, 54, 54),

    'gray22' -> Color.new255(56, 56, 56),

    'gray23' -> Color.new255(59, 59, 59),

    'gray24' -> Color.new255(61, 61, 61),

    'gray25' -> Color.new255(64, 64, 64),

    'gray26' -> Color.new255(66, 66, 66),

    'gray27' -> Color.new255(69, 69, 69),

    'gray28' -> Color.new255(71, 71, 71),

    'gray29' -> Color.new255(74, 74, 74),

    'gray3' -> Color.new255(8, 8, 8),

    'gray30' -> Color.new255(77, 77, 77),

    'gray31' -> Color.new255(79, 79, 79),

    'gray32' -> Color.new255(82, 82, 82),

    'gray33' -> Color.new255(84, 84, 84),

    'gray34' -> Color.new255(87, 87, 87),

    'gray35' -> Color.new255(89, 89, 89),

    'gray36' -> Color.new255(92, 92, 92),

    'gray37' -> Color.new255(94, 94, 94),

    'gray38' -> Color.new255(97, 97, 97),

    'gray39' -> Color.new255(99, 99, 99),

    'gray4' -> Color.new255(10, 10, 10),

    'gray40' -> Color.new255(102, 102, 102),

    'gray41' -> Color.new255(105, 105, 105),

    'gray42' -> Color.new255(107, 107, 107),

    'gray43' -> Color.new255(110, 110, 110),

    'gray44' -> Color.new255(112, 112, 112),

    'gray45' -> Color.new255(115, 115, 115),

    'gray46' -> Color.new255(117, 117, 117),

    'gray47' -> Color.new255(120, 120, 120),

    'gray48' -> Color.new255(122, 122, 122),

    'gray49' -> Color.new255(125, 125, 125),

    'gray5' -> Color.new255(13, 13, 13),

    'gray50' -> Color.new255(127, 127, 127),

    'gray51' -> Color.new255(130, 130, 130),

    'gray52' -> Color.new255(133, 133, 133),

    'gray53' -> Color.new255(135, 135, 135),

    'gray54' -> Color.new255(138, 138, 138),

    'gray55' -> Color.new255(140, 140, 140),

    'gray56' -> Color.new255(143, 143, 143),

    'gray57' -> Color.new255(145, 145, 145),

    'gray58' -> Color.new255(148, 148, 148),

    'gray59' -> Color.new255(150, 150, 150),

    'gray6' -> Color.new255(15, 15, 15),

    'gray60' -> Color.new255(153, 153, 153),

    'gray61' -> Color.new255(156, 156, 156),

    'gray62' -> Color.new255(158, 158, 158),

    'gray63' -> Color.new255(161, 161, 161),

    'gray64' -> Color.new255(163, 163, 163),

    'gray65' -> Color.new255(166, 166, 166),

    'gray66' -> Color.new255(168, 168, 168),

    'gray67' -> Color.new255(171, 171, 171),

    'gray68' -> Color.new255(173, 173, 173),

    'gray69' -> Color.new255(176, 176, 176),

    'gray7' -> Color.new255(18, 18, 18),

    'gray70' -> Color.new255(179, 179, 179),

    'gray71' -> Color.new255(181, 181, 181),

    'gray72' -> Color.new255(184, 184, 184),

    'gray73' -> Color.new255(186, 186, 186),

    'gray74' -> Color.new255(189, 189, 189),

    'gray75' -> Color.new255(191, 191, 191),

    'gray76' -> Color.new255(194, 194, 194),

    'gray77' -> Color.new255(196, 196, 196),

    'gray78' -> Color.new255(199, 199, 199),

    'gray79' -> Color.new255(201, 201, 201),

    'gray8' -> Color.new255(20, 20, 20),

    'gray80' -> Color.new255(204, 204, 204),

    'gray81' -> Color.new255(207, 207, 207),

    'gray82' -> Color.new255(209, 209, 209),

    'gray83' -> Color.new255(212, 212, 212),

    'gray84' -> Color.new255(214, 214, 214),

    'gray85' -> Color.new255(217, 217, 217),

    'gray86' -> Color.new255(219, 219, 219),

    'gray87' -> Color.new255(222, 222, 222),

    'gray88' -> Color.new255(224, 224, 224),

    'gray89' -> Color.new255(227, 227, 227),

    'gray9' -> Color.new255(23, 23, 23),

    'gray90' -> Color.new255(229, 229, 229),

    'gray91' -> Color.new255(232, 232, 232),

    'gray92' -> Color.new255(235, 235, 235),

    'gray93' -> Color.new255(237, 237, 237),

    'gray94' -> Color.new255(240, 240, 240),

    'gray95' -> Color.new255(242, 242, 242),

    'gray96' -> Color.new255(245, 245, 245),

    'gray97' -> Color.new255(247, 247, 247),

    'gray98' -> Color.new255(250, 250, 250),

    'gray99' -> Color.new255(252, 252, 252),

    'green' -> Color.new255(0, 255, 0),

    'green yellow' -> Color.new255(173, 255, 47),

    'green1' -> Color.new255(0, 255, 0),

    'green2' -> Color.new255(0, 238, 0),

    'green3' -> Color.new255(0, 205, 0),

    'green4' -> Color.new255(0, 139, 0),

    'GreenYellow' -> Color.new255(173, 255, 47),

    'grey' -> Color.new255(190, 190, 190),

    'grey0' -> Color.new255(0, 0, 0),

    'grey1' -> Color.new255(3, 3, 3),

    'grey10' -> Color.new255(26, 26, 26),

    'grey100' -> Color.new255(255, 255, 255),

    'grey11' -> Color.new255(28, 28, 28),

    'grey12' -> Color.new255(31, 31, 31),

    'grey13' -> Color.new255(33, 33, 33),

    'grey14' -> Color.new255(36, 36, 36),

    'grey15' -> Color.new255(38, 38, 38),

    'grey16' -> Color.new255(41, 41, 41),

    'grey17' -> Color.new255(43, 43, 43),

    'grey18' -> Color.new255(46, 46, 46),

    'grey19' -> Color.new255(48, 48, 48),

    'grey2' -> Color.new255(5, 5, 5),

    'grey20' -> Color.new255(51, 51, 51),

    'grey21' -> Color.new255(54, 54, 54),

    'grey22' -> Color.new255(56, 56, 56),

    'grey23' -> Color.new255(59, 59, 59),

    'grey24' -> Color.new255(61, 61, 61),

    'grey25' -> Color.new255(64, 64, 64),

    'grey26' -> Color.new255(66, 66, 66),

    'grey27' -> Color.new255(69, 69, 69),

    'grey28' -> Color.new255(71, 71, 71),

    'grey29' -> Color.new255(74, 74, 74),

    'grey3' -> Color.new255(8, 8, 8),

    'grey30' -> Color.new255(77, 77, 77),

    'grey31' -> Color.new255(79, 79, 79),

    'grey32' -> Color.new255(82, 82, 82),

    'grey33' -> Color.new255(84, 84, 84),

    'grey34' -> Color.new255(87, 87, 87),

    'grey35' -> Color.new255(89, 89, 89),

    'grey36' -> Color.new255(92, 92, 92),

    'grey37' -> Color.new255(94, 94, 94),

    'grey38' -> Color.new255(97, 97, 97),

    'grey39' -> Color.new255(99, 99, 99),

    'grey4' -> Color.new255(10, 10, 10),

    'grey40' -> Color.new255(102, 102, 102),

    'grey41' -> Color.new255(105, 105, 105),

    'grey42' -> Color.new255(107, 107, 107),

    'grey43' -> Color.new255(110, 110, 110),

    'grey44' -> Color.new255(112, 112, 112),

    'grey45' -> Color.new255(115, 115, 115),

    'grey46' -> Color.new255(117, 117, 117),

    'grey47' -> Color.new255(120, 120, 120),

    'grey48' -> Color.new255(122, 122, 122),

    'grey49' -> Color.new255(125, 125, 125),

    'grey5' -> Color.new255(13, 13, 13),

    'grey50' -> Color.new255(127, 127, 127),

    'grey51' -> Color.new255(130, 130, 130),

    'grey52' -> Color.new255(133, 133, 133),

    'grey53' -> Color.new255(135, 135, 135),

    'grey54' -> Color.new255(138, 138, 138),

    'grey55' -> Color.new255(140, 140, 140),

    'grey56' -> Color.new255(143, 143, 143),

    'grey57' -> Color.new255(145, 145, 145),

    'grey58' -> Color.new255(148, 148, 148),

    'grey59' -> Color.new255(150, 150, 150),

    'grey6' -> Color.new255(15, 15, 15),

    'grey60' -> Color.new255(153, 153, 153),

    'grey61' -> Color.new255(156, 156, 156),

    'grey62' -> Color.new255(158, 158, 158),

    'grey63' -> Color.new255(161, 161, 161),

    'grey64' -> Color.new255(163, 163, 163),

    'grey65' -> Color.new255(166, 166, 166),

    'grey66' -> Color.new255(168, 168, 168),

    'grey67' -> Color.new255(171, 171, 171),

    'grey68' -> Color.new255(173, 173, 173),

    'grey69' -> Color.new255(176, 176, 176),

    'grey7' -> Color.new255(18, 18, 18),

    'grey70' -> Color.new255(179, 179, 179),

    'grey71' -> Color.new255(181, 181, 181),

    'grey72' -> Color.new255(184, 184, 184),

    'grey73' -> Color.new255(186, 186, 186),

    'grey74' -> Color.new255(189, 189, 189),

    'grey75' -> Color.new255(191, 191, 191),

    'grey76' -> Color.new255(194, 194, 194),

    'grey77' -> Color.new255(196, 196, 196),

    'grey78' -> Color.new255(199, 199, 199),

    'grey79' -> Color.new255(201, 201, 201),

    'grey8' -> Color.new255(20, 20, 20),

    'grey80' -> Color.new255(204, 204, 204),

    'grey81' -> Color.new255(207, 207, 207),

    'grey82 Berlin: clubs bars cafes nightlife going out