The [colorRef] command.

Introduction

The colorRef command lets you create and manipulate colors in Alpha.

Synopsis

The formal syntax of the [colorRef] command is:
colorRef subcommand ?options?
The possible subcommands are described below. Depending on the subcommand, various options can be additionally specified.

The [components] subcommand

This subcommand lets you get the components of a color. The syntax is:
    colorRef components ?-space (RGB|CYMK|HSB|GRAY)? ?-alpha (0|1)? token

The token argument designates the color whose components you want to retrieve.
The
-space option has the same meaning as with the [colorRef create] command. The default value is RGB. You do not need necessarily to specify the same color space as when the color was created: this command can be used to convert a color from a color space to the other.
The
-alpha option specifies whether the opacity (alpha component) should be included. By default, this option is set to 0.

The [create] subcommand

This subcommand creates a new color. It has the following syntax:
    colorRef create ?-space (RGB|CYMK|HSB|GRAY)? components...
The command returns a token used in the other subcommands to uniquely identify the color.
The
-space option lets you specify the color space in which the color components are defined. The possible values are : The default color space is RGB.
The components argument represents the coordinates of the color in the colorspace.
The last component is optional and corresponds to the opacity (aka the alpha channel). If it is not specified, the opacity is set by default to 1.0 (which means the image is totally opaque).
The values of the components are real numbers between 0.0 and 1.0. Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
The number of expected components depends on the color space which is used and on the opacity. In the case of the RGB and HSB color spaces, there should be 3 or 4 components. In the case of the CYMK color space, there should be 4 or 5 components. In the case of the GRAY color space, there should be 1 or 2 components: the first one is the level of gray and the second one is an optional value for the opacity.

The [delete] subcommand

This subcommand lets you delete a color. The syntax is:
	colorRef delete token
After deletion, the token associated with this color is not valid anymore.

The [list] subcommand

This subcommand returns a list of the existing color tokens. The syntax is:
	colorRef list

The [named] subcommand

This subcommand is used to find named colors. The syntax is:
	colorRef named name
It returns a token for the color designated by the name argument if this name exists in the catalog or otherwise raises an error. See the table in the
Color Names section for a list of possible values.

The [names] subcommand

This subcommand returns a list of color names. The syntax is:
	colorRef names
Alpha is built with a colors catalog containing predefined colors designated by a name. This command returns the list of all the names available in the catalog.
See the table in the
Color Names section for the exact specification of all the named colors.

The [panel] subcommand

This subcommand displays the color panel. The syntax is:
    colorRef panel ?-space (RGB|CYMK|HSB|GRAY)? ?-alpha (0|1)? \
	     ?-default {r g b ?a?}?
The options have the following signification:
-alpha
this option specifies whether the color picker should allow selecting the opacity of the color. By default, this option is set to 0.
-default
this option specifies an initial set of values for the color picker. Its value is a list of three or four floating numbers between 0 and 1 representing the RGB components and an optional alpha component (equal to 1 by default).
-space
this option has the same meaning as with the [colorRef create] command. The default value is RGB.
-title
this option specifies a title for the color picker window.
The command does not return anything. The color panel acts on the current document window: the color chosen in the panel applies to the current selection.
If you need to ask the user to select a color, use the
[colorRef pick] command instead.

The [pick] subcommand

This subcommand lets you get the components of a color using a color picker. The syntax is:
    colorRef pick ?-space (RGB|CYMK|HSB|GRAY)? ?-alpha (0|1)? \
	     ?-default {r g b ?a?}? ?-title str?
The options
-alpha, -default, -space have the same meaning as with the [colorRef panel] command. The -title option specifies a title for the color picker window.
The difference between the
[colorRef panel] and the [colorRef pick] commands is that the former displays the panel and returns immediately whereas the latter is run modally and presents Cancel and OK buttons to exit the dialog.
The command returns a list of floating values (between 0 and 1) corresponding to the components of the chosen color. The number of components depends on the color space: in the case of the default RGB space, the command returns a three-element list with the red, green and blue components.

The [space] subcommand

This subcommand returns the name of the color space in which a color is defined. The syntax is:
	colorRef space token
The color is designated by its token. Note that colors created in the HSB colorspace are silently converted by Cocoa into the RGB colorspace: the returned info is the RGB colorspace.

Color names

Here is the complete list of the 657 colors defined in the Alpha colors catalog with their specification in the RGB color space.
NameRGB
aliceblue0.940.971
antiquewhite110.940.86
antiquewhite20.930.870.8
antiquewhite30.80.750.69
antiquewhite40.550.510.47
antiquewhite0.980.920.84
aquamarine10.510.83
aquamarine20.460.930.78
aquamarine30.40.80.67
aquamarine40.270.550.45
aquamarine0.510.83
azure10.9411
azure20.880.930.93
azure30.760.80.8
azure40.510.550.55
azure0.9411
beige0.960.960.86
bisque110.890.77
bisque20.930.840.72
bisque30.80.720.62
bisque40.550.490.42
bisque10.890.77
black000
blanchedalmond10.920.8
blue1001
blue2000.93
blue3000.8
blue4000.55
blue001
blueviolet0.540.170.89
brown110.250.25
brown20.930.230.23
brown30.80.20.2
brown40.550.140.14
brown0.650.160.16
burlywood110.830.61
burlywood20.930.770.57
burlywood30.80.670.49
burlywood40.550.450.33
burlywood0.870.720.53
cadetblue10.60.961
cadetblue20.560.90.93
cadetblue30.480.770.8
cadetblue40.330.530.55
cadetblue0.370.620.63
chartreuse10.510
chartreuse20.460.930
chartreuse30.40.80
chartreuse40.270.550
chartreuse0.510
chocolate110.50.14
chocolate20.930.460.13
chocolate30.80.40.11
chocolate40.550.270.07
chocolate0.820.410.12
coral110.450.34
coral20.930.420.31
coral30.80.360.27
coral40.550.240.18
coral10.50.31
cornflowerblue0.390.580.93
cornsilk110.970.86
cornsilk20.930.910.8
cornsilk30.80.780.69
cornsilk40.550.530.47
cornsilk10.970.86
cyan1011
cyan200.930.93
cyan300.80.8
cyan400.550.55
cyan011
darkblue000.55
darkcyan00.550.55
darkgoldenrod110.730.06
darkgoldenrod20.930.680.05
darkgoldenrod30.80.580.05
darkgoldenrod40.550.40.03
darkgoldenrod0.720.530.04
darkgray0.660.660.66
darkgreen00.390
darkgrey0.660.660.66
darkkhaki0.740.720.42
darkmagenta0.5500.55
darkolivegreen10.7910.44
darkolivegreen20.740.930.41
darkolivegreen30.640.80.35
darkolivegreen40.430.550.24
darkolivegreen0.330.420.18
darkorange110.50
darkorange20.930.460
darkorange30.80.40
darkorange40.550.270
darkorange10.550
darkorchid10.750.241
darkorchid20.70.230.93
darkorchid30.60.20.8
darkorchid40.410.130.55
darkorchid0.60.20.8
darkred0.5500
darksalmon0.910.590.48
darkseagreen10.7610.76
darkseagreen20.710.930.71
darkseagreen30.610.80.61
darkseagreen40.410.550.41
darkseagreen0.560.740.56
darkslateblue0.280.240.55
darkslategray10.5911
darkslategray20.550.930.93
darkslategray30.470.80.8
darkslategray40.320.550.55
darkslategray0.180.310.31
darkslategrey0.180.310.31
darkturquoise00.810.82
darkviolet0.5800.83
deeppink110.080.58
deeppink20.930.070.54
deeppink30.80.060.46
deeppink40.550.040.31
deeppink10.080.58
deepskyblue100.751
deepskyblue200.70.93
deepskyblue300.60.8
deepskyblue400.410.55
deepskyblue00.751
dimgray0.410.410.41
dimgrey0.410.410.41
dodgerblue10.120.561
dodgerblue20.110.530.93
dodgerblue30.090.450.8
dodgerblue40.060.310.55
dodgerblue0.120.561
firebrick110.190.19
firebrick20.930.170.17
firebrick30.80.150.15
firebrick40.550.10.1
firebrick0.70.130.13
floralwhite10.980.94
forestgreen0.130.550.13
gainsboro0.860.860.86
ghostwhite0.970.971
gold110.840
gold20.930.790
gold30.80.680
gold40.550.460
gold10.840
goldenrod110.760.15
goldenrod20.930.710.13
goldenrod30.80.610.11
goldenrod40.550.410.08
goldenrod0.850.650.13
gray0000
gray10.010.010.01
gray20.020.020.02
gray30.030.030.03
gray40.040.040.04
gray50.050.050.05
gray60.060.060.06
gray70.070.070.07
gray80.080.080.08
gray90.090.090.09
gray100.10.10.1
gray110.110.110.11
gray120.120.120.12
gray130.130.130.13
gray140.140.140.14
gray150.150.150.15
gray160.160.160.16
gray170.170.170.17
gray180.180.180.18
gray190.190.190.19
gray200.20.20.2
gray210.210.210.21
gray220.220.220.22
gray230.230.230.23
gray240.240.240.24
gray250.250.250.25
gray260.260.260.26
gray270.270.270.27
gray280.280.280.28
gray290.290.290.29
gray300.30.30.3
gray310.310.310.31
gray320.320.320.32
gray330.330.330.33
gray340.340.340.34
gray350.350.350.35
gray360.360.360.36
gray370.370.370.37
gray380.380.380.38
gray390.390.390.39
gray400.40.40.4
gray410.410.410.41
gray420.420.420.42
gray430.430.430.43
gray440.440.440.44
gray450.450.450.45
gray460.460.460.46
gray470.470.470.47
gray480.480.480.48
gray490.490.490.49
gray500.50.50.5
gray510.510.510.51
gray520.520.520.52
gray530.530.530.53
gray540.540.540.54
gray550.550.550.55
gray560.560.560.56
gray570.570.570.57
gray580.580.580.58
gray590.590.590.59
gray600.60.60.6
gray610.610.610.61
gray620.620.620.62
gray630.630.630.63
gray640.640.640.64
gray650.650.650.65
gray660.660.660.66
gray670.670.670.67
gray680.680.680.68
gray690.690.690.69
gray700.70.70.7
gray710.710.710.71
gray720.720.720.72
gray730.730.730.73
gray740.740.740.74
gray750.750.750.75
gray760.760.760.76
gray770.770.770.77
gray780.780.780.78
gray790.790.790.79
gray800.80.80.8
gray810.810.810.81
gray820.820.820.82
gray830.830.830.83
gray840.840.840.84
gray850.850.850.85
gray860.860.860.86
gray870.870.870.87
gray880.880.880.88
gray890.890.890.89
gray900.90.90.9
gray910.910.910.91
gray920.920.920.92
gray930.930.930.93
gray940.940.940.94
gray950.950.950.95
gray960.960.960.96
gray970.970.970.97
gray980.980.980.98
gray990.990.990.99
gray100111
gray0.750.750.75
green1010
green200.930
green300.80
green400.550
green0.010.510.05
greenyellow0.6810.18
grey0000
grey10.010.010.01
grey20.020.020.02
grey30.030.030.03
grey40.040.040.04
grey50.050.050.05
grey60.060.060.06
grey70.070.070.07
grey80.080.080.08
grey90.090.090.09
grey100.10.10.1
grey110.110.110.11
grey120.120.120.12
grey130.130.130.13
grey140.140.140.14
grey150.150.150.15
grey160.160.160.16
grey170.170.170.17
grey180.180.180.18
grey190.190.190.19
grey200.20.20.2
grey210.210.210.21
grey220.220.220.22
grey230.230.230.23
grey240.240.240.24
grey250.250.250.25
grey260.260.260.26
grey270.270.270.27
grey280.280.280.28
grey290.290.290.29
grey300.30.30.3
grey310.310.310.31
grey320.320.320.32
grey330.330.330.33
grey340.340.340.34
grey350.350.350.35
grey360.360.360.36
grey370.370.370.37
grey380.380.380.38
grey390.390.390.39
grey400.40.40.4
grey410.410.410.41
grey420.420.420.42
grey430.430.430.43
grey440.440.440.44
grey450.450.450.45
grey460.460.460.46
grey470.470.470.47
grey480.480.480.48
grey490.490.490.49
grey500.50.50.5
grey510.510.510.51
grey520.520.520.52
grey530.530.530.53
grey540.540.540.54
grey550.550.550.55
grey560.560.560.56
grey570.570.570.57
grey580.580.580.58
grey590.590.590.59
grey600.60.60.6
grey610.610.610.61
grey620.620.620.62
grey630.630.630.63
grey640.640.640.64
grey650.650.650.65
grey660.660.660.66
grey670.670.670.67
grey680.680.680.68
grey690.690.690.69
grey700.70.70.7
grey710.710.710.71
grey720.720.720.72
grey730.730.730.73
grey740.740.740.74
grey750.750.750.75
grey760.760.760.76
grey770.770.770.77
grey780.780.780.78
grey790.790.790.79
grey800.80.80.8
grey810.810.810.81
grey820.820.820.82
grey830.830.830.83
grey840.840.840.84
grey850.850.850.85
grey860.860.860.86
grey870.870.870.87
grey880.880.880.88
grey890.890.890.89
grey900.90.90.9
grey910.910.910.91
grey920.920.920.92
grey930.930.930.93
grey940.940.940.94
grey950.950.950.95
grey960.960.960.96
grey970.970.970.97
grey980.980.980.98
grey990.990.990.99
grey100111
grey0.750.750.75
honeydew10.9410.94
honeydew20.880.930.88
honeydew30.760.80.76
honeydew40.510.550.51
honeydew0.9410.94
hotpink110.430.71
hotpink20.930.420.65
hotpink30.80.380.56
hotpink40.550.230.38
hotpink10.410.71
indianred110.420.42
indianred20.930.390.39
indianred30.80.330.33
indianred40.550.230.23
indianred0.80.360.36
ivory1110.94
ivory20.930.930.88
ivory30.80.80.76
ivory40.550.550.51
ivory110.94
khaki110.960.56
khaki20.930.90.52
khaki30.80.780.45
khaki40.550.530.31
khaki0.940.90.55
lavender0.90.90.98
lavenderblush110.940.96
lavenderblush20.930.880.9
lavenderblush30.80.760.77
lavenderblush40.550.510.53
lavenderblush10.940.96
lawngreen0.490.990
lemonchiffon110.980.8
lemonchiffon20.930.910.75
lemonchiffon30.80.790.65
lemonchiffon40.550.540.44
lemonchiffon10.980.8
lightblue10.750.941
lightblue20.70.870.93
lightblue30.60.750.8
lightblue40.410.510.55
lightblue0.680.850.9
lightcoral0.940.50.5
lightcyan10.8811
lightcyan20.820.930.93
lightcyan30.710.80.8
lightcyan40.480.550.55
lightcyan0.8811
lightgoldenrod110.930.55
lightgoldenrod20.930.860.51
lightgoldenrod30.80.750.44
lightgoldenrod40.550.510.3
lightgoldenrod0.930.870.51
lightgoldenrodyellow0.980.980.82
lightgray0.830.830.83
lightgreen0.560.930.56
lightgrey0.830.830.83
lightpink110.680.73
lightpink20.930.640.68
lightpink30.80.550.58
lightpink40.550.370.4
lightpink10.710.76
lightsalmon110.630.48
lightsalmon20.930.580.45
lightsalmon30.80.510.38
lightsalmon40.550.340.26
lightsalmon10.630.48
lightseagreen0.130.70.67
lightskyblue10.690.891
lightskyblue20.640.830.93
lightskyblue30.550.710.8
lightskyblue40.380.480.55
lightskyblue0.530.810.98
lightslateblue0.520.441
lightslategray0.470.530.6
lightslategrey0.470.530.6
lightsteelblue10.790.881
lightsteelblue20.740.820.93
lightsteelblue30.640.710.8
lightsteelblue40.430.480.55
lightsteelblue0.690.770.87
lightyellow1110.88
lightyellow20.930.930.82
lightyellow30.80.80.71
lightyellow40.550.550.48
lightyellow110.88
limegreen0.20.80.2
linen0.980.940.9
magenta1101
magenta20.9300.93
magenta30.800.8
magenta40.5500.55
magenta0.680.020.78
maroon110.20.7
maroon20.930.190.65
maroon30.80.160.56
maroon40.550.110.38
maroon0.690.190.38
mediumaquamarine0.40.80.67
mediumblue000.8
mediumorchid10.880.41
mediumorchid20.820.370.93
mediumorchid30.710.320.8
mediumorchid40.480.220.55
mediumorchid0.730.330.83
mediumpurple10.670.511
mediumpurple20.620.470.93
mediumpurple30.540.410.8
mediumpurple40.360.280.55
mediumpurple0.580.440.86
mediumseagreen0.240.70.44
mediumslateblue0.480.410.93
mediumspringgreen00.980.6
mediumturquoise0.280.820.8
mediumvioletred0.780.080.52
midnightblue0.10.10.44
mintcream0.9610.98
mistyrose110.890.88
mistyrose20.930.840.82
mistyrose30.80.720.71
mistyrose40.550.490.48
mistyrose10.890.88
moccasin10.890.71
navajowhite110.870.68
navajowhite20.930.810.63
navajowhite30.80.70.55
navajowhite40.550.470.37
navajowhite10.870.68
navy000.5
navyblue000.5
oldlace0.990.960.9
olivedrab10.7510.24
olivedrab20.70.930.23
olivedrab30.60.80.2
olivedrab40.410.550.13
olivedrab0.420.560.14
orange110.650
orange20.930.60
orange30.80.520
orange40.550.350
orange10.650
orangered110.270
orangered20.930.250
orangered30.80.220
orangered40.550.150
orangered10.270
orchid110.510.98
orchid20.930.480.91
orchid30.80.410.79
orchid40.550.280.54
orchid0.850.440.84
palegoldenrod0.930.910.67
palegreen10.610.6
palegreen20.560.930.56
palegreen30.490.80.49
palegreen40.330.550.33
palegreen0.60.980.6
paleturquoise10.7311
paleturquoise20.680.930.93
paleturquoise30.590.80.8
paleturquoise40.40.550.55
paleturquoise0.690.930.93
palevioletred110.510.67
palevioletred20.930.470.62
palevioletred30.80.410.54
palevioletred40.550.280.36
palevioletred0.860.440.58
papayawhip10.940.84
peachpuff110.850.73
peachpuff20.930.80.68
peachpuff30.80.690.58
peachpuff40.550.470.4
peachpuff10.850.73
peru0.80.520.25
pink110.710.77
pink20.930.660.72
pink30.80.570.62
pink40.550.390.42
pink10.750.8
plum110.731
plum20.930.680.93
plum30.80.590.8
plum40.550.40.55
plum0.870.630.87
powderblue0.690.880.9
purple10.610.191
purple20.570.170.93
purple30.490.150.8
purple40.330.10.55
purple0.630.130.94
red1100
red20.9300
red30.800
red40.5500
red100
rosybrown110.760.76
rosybrown20.930.710.71
rosybrown30.80.610.61
rosybrown40.550.410.41
rosybrown0.740.560.56
royalblue10.280.461
royalblue20.260.430.93
royalblue30.230.370.8
royalblue40.150.250.55
royalblue0.250.410.88
saddlebrown0.550.270.07
salmon110.550.41
salmon20.930.510.38
salmon30.80.440.33
salmon40.550.30.22
salmon0.980.50.45
sandybrown0.960.640.38
seagreen10.3310.62
seagreen20.310.930.58
seagreen30.260.80.5
seagreen40.180.550.34
seagreen0.180.550.34
seashell110.960.93
seashell20.930.90.87
seashell30.80.770.75
seashell40.550.530.51
seashell10.960.93
sienna110.510.28
sienna20.930.470.26
sienna30.80.410.22
sienna40.550.280.15
sienna0.630.320.18
skyblue10.530.811
skyblue20.490.750.93
skyblue30.420.650.8
skyblue40.290.440.55
skyblue0.530.810.92
slateblue10.510.441
slateblue20.480.40.93
slateblue30.410.350.8
slateblue40.280.240.55
slateblue0.420.350.8
slategray10.780.891
slategray20.730.830.93
slategray30.620.710.8
slategray40.420.480.55
slategray0.440.50.56
slategrey0.440.50.56
snow110.980.98
snow20.930.910.91
snow30.80.790.79
snow40.550.540.54
snow10.980.98
springgreen1010.5
springgreen200.930.46
springgreen300.80.4
springgreen400.550.27
springgreen010.5
steelblue10.390.721
steelblue20.360.670.93
steelblue30.310.580.8
steelblue40.210.390.55
steelblue0.270.510.71
tan110.650.31
tan20.930.60.29
tan30.80.520.25
tan40.550.350.17
tan0.820.710.55
thistle110.881
thistle20.930.820.93
thistle30.80.710.8
thistle40.550.480.55
thistle0.850.750.85
tomato110.390.28
tomato20.930.360.26
tomato30.80.310.22
tomato40.550.210.15
tomato10.390.28
turquoise100.961
turquoise200.90.93
turquoise300.770.8
turquoise400.530.55
turquoise0.250.880.82
violet0.930.510.93
violetred110.240.59
violetred20.930.230.55
violetred30.80.20.47
violetred40.550.130.32
violetred0.820.130.56
wheat110.910.73
wheat20.930.850.68
wheat30.80.730.59
wheat40.550.490.4
wheat0.960.870.7
white111
whitesmoke0.960.960.96
yellow1110
yellow20.930.930
yellow30.80.80
yellow40.550.550
yellow110
yellowgreen0.60.80.2

Examples



Last updated 2016-11-23 15:54:15