[/] [trunk/] [src/] [graphviz/] [x11color.sml] - Blame information for rev 62

Line No. Rev Author Line
1 62 tbourke
(* $Id: x11color.sml 62 2008-08-20 11:20:33Z tbourke $
2
 *
3
 * Copyright (c) 2008 Timothy Bourke (University of NSW and NICTA)
4
 * All rights reserved.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the "BSD License" which is distributed with the
8
 * software in the file LICENSE.
9
 *
10
 * This program is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the BSD
13
 * License for more details.
14
 *)
15 4 tbourke
structure X11Color : X11_COLOR =
16
struct
17
  datatype t = LightPink | Pink | Crimson | LavenderBlush | PaleVioletRed
18
             | HotPink | DeepPink | MediumVioletRed | Orchid
19
             | Thistle | Plum | Violet | Magenta
20
             | Fuchsia | DarkMagenta | Purple | MediumOrchid
21
             | DarkViolet | DarkOrchid | Indigo | BlueViolet
22
             | MediumPurple | MediumSlateBlue | SlateBlue | DarkSlateBlue
23
             | Lavender | GhostWhite | Blue | MediumBlue
24
             | MidnightBlue | DarkBlue | Navy | RoyalBlue
25
             | CornflowerBlue | LightSteelBlue | LightSlateGray | SlateGray
26
             | DodgerBlue | AliceBlue | SteelBlue | LightSkyBlue
27
             | SkyBlue | DeepSkyBlue | LightBlue | PowderBlue
28
             | CadetBlue | Azure | LightCyan | PaleTurquoise
29
             | Cyan | Aqua | DarkTurquoise | DarkSlateGray
30
             | DarkCyan | Teal | MediumTurquoise | LightSeaGreen
31
             | Turquoise | Aquamarine | MediumAquamarine | MediumSpringGreen
32
             | MintCream | SpringGreen | MediumSeaGreen | SeaGreen
33
             | Honeydew | LightGreen | PaleGreen | DarkSeaGreen
34
             | LimeGreen | Lime | ForestGreen | Green
35
             | DarkGreen | Chartreuse | LawnGreen | GreenYellow
36
             | DarkOliveGreen | YellowGreen | OliveDrab | Beige
37
             | LightGoldenrodYellow | Ivory | LightYellow | Yellow
38
             | Olive | DarkKhaki | LemonChiffon | PaleGoldenrod
39
             | Khaki | Gold | Cornsilk | Goldenrod
40
             | DarkGoldenrod | FloralWhite | OldLace | Wheat
41
             | Moccasin | Orange | PapayaWhip | BlanchedAlmond
42
             | NavajoWhite | AntiqueWhite | Tan | BurlyWood
43
             | Bisque | DarkOrange | Linen | Peru
44
             | PeachPuff | SandyBrown | Chocolate | SaddleBrown
45
             | Seashell | Sienna | LightSalmon | Coral
46
             | OrangeRed | DarkSalmon | Tomato | MistyRose
47
             | Salmon | Snow | LightCoral | RosyBrown
48
             | IndianRed | Red | Brown | FireBrick
49
             | DarkRed | Maroon | White | WhiteSmoke
50
             | Gainsboro | LightGrey | Silver | DarkGray
51
             | Gray | DimGray | Black
52
 
53
  fun toString LightPink                = "lightpink"
54
    | toString Pink                     = "pink"
55
    | toString Crimson                  = "crimson"
56
    | toString LavenderBlush            = "lavenderblush"
57
    | toString PaleVioletRed            = "palevioletred"
58
    | toString HotPink                  = "hotpink"
59
    | toString DeepPink                 = "deeppink"
60
    | toString MediumVioletRed          = "mediumvioletred"
61
    | toString Orchid                   = "orchid"
62
    | toString Thistle                  = "thistle"
63
    | toString Plum                     = "plum"
64
    | toString Violet                   = "violet"
65
    | toString Magenta                  = "magenta"
66
    | toString Fuchsia                  = "fuchsia"
67
    | toString DarkMagenta              = "darkmagenta"
68
    | toString Purple                   = "purple"
69
    | toString MediumOrchid             = "mediumorchid"
70
    | toString DarkViolet               = "darkviolet"
71
    | toString DarkOrchid               = "darkorchid"
72
    | toString Indigo                   = "indigo"
73
    | toString BlueViolet               = "blueviolet"
74
    | toString MediumPurple             = "mediumpurple"
75
    | toString MediumSlateBlue          = "mediumslateblue"
76
    | toString SlateBlue                = "slateblue"
77
    | toString DarkSlateBlue            = "darkslateblue"
78
    | toString Lavender                 = "lavender"
79
    | toString GhostWhite               = "ghostwhite"
80
    | toString Blue                     = "blue"
81
    | toString MediumBlue               = "mediumblue"
82
    | toString MidnightBlue             = "midnightblue"
83
    | toString DarkBlue                 = "darkblue"
84
    | toString Navy                     = "navy"
85
    | toString RoyalBlue                = "royalblue"
86
    | toString CornflowerBlue           = "cornflowerblue"
87
    | toString LightSteelBlue           = "lightsteelblue"
88
    | toString LightSlateGray           = "lightslategray"
89
    | toString SlateGray                = "slategray"
90
    | toString DodgerBlue               = "dodgerblue"
91
    | toString AliceBlue                = "aliceblue"
92
    | toString SteelBlue                = "steelblue"
93
    | toString LightSkyBlue             = "lightskyblue"
94
    | toString SkyBlue                  = "skyblue"
95
    | toString DeepSkyBlue              = "deepskyblue"
96
    | toString LightBlue                = "lightblue"
97
    | toString PowderBlue               = "powderblue"
98
    | toString CadetBlue                = "cadetblue"
99
    | toString Azure                    = "azure"
100
    | toString LightCyan                = "lightcyan"
101
    | toString PaleTurquoise            = "paleturquoise"
102
    | toString Cyan                     = "cyan"
103
    | toString Aqua                     = "aqua"
104
    | toString DarkTurquoise            = "darkturquoise"
105
    | toString DarkSlateGray            = "darkslategray"
106
    | toString DarkCyan                 = "darkcyan"
107
    | toString Teal                     = "teal"
108
    | toString MediumTurquoise          = "mediumturquoise"
109
    | toString LightSeaGreen            = "lightseagreen"
110
    | toString Turquoise                = "turquoise"
111
    | toString Aquamarine               = "aquamarine"
112
    | toString MediumAquamarine         = "mediumaquamarine"
113
    | toString MediumSpringGreen        = "mediumspringgreen"
114
    | toString MintCream                = "mintcream"
115
    | toString SpringGreen              = "springgreen"
116
    | toString MediumSeaGreen           = "mediumseagreen"
117
    | toString SeaGreen                 = "seagreen"
118
    | toString Honeydew                 = "honeydew"
119
    | toString LightGreen               = "lightgreen"
120
    | toString PaleGreen                = "palegreen"
121
    | toString DarkSeaGreen             = "darkseagreen"
122
    | toString LimeGreen                = "limegreen"
123
    | toString Lime                     = "lime"
124
    | toString ForestGreen              = "forestgreen"
125
    | toString Green                    = "green"
126
    | toString DarkGreen                = "darkgreen"
127
    | toString Chartreuse               = "chartreuse"
128
    | toString LawnGreen                = "lawngreen"
129
    | toString GreenYellow              = "greenyellow"
130
    | toString DarkOliveGreen           = "darkolivegreen"
131
    | toString YellowGreen              = "yellowgreen"
132
    | toString OliveDrab                = "olivedrab"
133
    | toString Beige                    = "beige"
134
    | toString LightGoldenrodYellow     = "lightgoldenrodyellow"
135
    | toString Ivory                    = "ivory"
136
    | toString LightYellow              = "lightyellow"
137
    | toString Yellow                   = "yellow"
138
    | toString Olive                    = "olive"
139
    | toString DarkKhaki                = "darkkhaki"
140
    | toString LemonChiffon             = "lemonchiffon"
141
    | toString PaleGoldenrod            = "palegoldenrod"
142
    | toString Khaki                    = "khaki"
143
    | toString Gold                     = "gold"
144
    | toString Cornsilk                 = "cornsilk"
145
    | toString Goldenrod                = "goldenrod"
146
    | toString DarkGoldenrod            = "darkgoldenrod"
147
    | toString FloralWhite              = "floralwhite"
148
    | toString OldLace                  = "oldlace"
149
    | toString Wheat                    = "wheat"
150
    | toString Moccasin                 = "moccasin"
151
    | toString Orange                   = "orange"
152
    | toString PapayaWhip               = "papayawhip"
153
    | toString BlanchedAlmond           = "blanchedalmond"
154
    | toString NavajoWhite              = "navajowhite"
155
    | toString AntiqueWhite             = "antiquewhite"
156
    | toString Tan                      = "tan"
157
    | toString BurlyWood                = "burlywood"
158
    | toString Bisque                   = "bisque"
159
    | toString DarkOrange               = "darkorange"
160
    | toString Linen                    = "linen"
161
    | toString Peru                     = "peru"
162
    | toString PeachPuff                = "peachpuff"
163
    | toString SandyBrown               = "sandybrown"
164
    | toString Chocolate                = "chocolate"
165
    | toString SaddleBrown              = "saddlebrown"
166
    | toString Seashell                 = "seashell"
167
    | toString Sienna                   = "sienna"
168
    | toString LightSalmon              = "lightsalmon"
169
    | toString Coral                    = "coral"
170
    | toString OrangeRed                = "orangered"
171
    | toString DarkSalmon               = "darksalmon"
172
    | toString Tomato                   = "tomato"
173
    | toString MistyRose                = "mistyrose"
174
    | toString Salmon                   = "salmon"
175
    | toString Snow                     = "snow"
176
    | toString LightCoral               = "lightcoral"
177
    | toString RosyBrown                = "rosybrown"
178
    | toString IndianRed                = "indianred"
179
    | toString Red                      = "red"
180
    | toString Brown                    = "brown"
181
    | toString FireBrick                = "firebrick"
182
    | toString DarkRed                  = "darkred"
183
    | toString Maroon                   = "maroon"
184
    | toString White                    = "white"
185
    | toString WhiteSmoke               = "whitesmoke"
186
    | toString Gainsboro                = "gainsboro"
187
    | toString LightGrey                = "lightgrey"
188
    | toString Silver                   = "silver"
189
    | toString DarkGray                 = "darkgray"
190
    | toString Gray                     = "gray"
191
    | toString DimGray                  = "dimgray"
192
    | toString Black                    = "black"
193
 
194
  fun fromString "lightpink"            = LightPink
195
    | fromString "pink"                 = Pink
196
    | fromString "crimson"              = Crimson
197
    | fromString "lavenderblush"        = LavenderBlush
198
    | fromString "palevioletred"        = PaleVioletRed
199
    | fromString "hotpink"              = HotPink
200
    | fromString "deeppink"             = DeepPink
201
    | fromString "mediumvioletred"      = MediumVioletRed
202
    | fromString "orchid"               = Orchid
203
    | fromString "thistle"              = Thistle
204
    | fromString "plum"                 = Plum
205
    | fromString "violet"               = Violet
206
    | fromString "magenta"              = Magenta
207
    | fromString "fuchsia"              = Fuchsia
208
    | fromString "darkmagenta"          = DarkMagenta
209
    | fromString "purple"               = Purple
210
    | fromString "mediumorchid"         = MediumOrchid
211
    | fromString "darkviolet"           = DarkViolet
212
    | fromString "darkorchid"           = DarkOrchid
213
    | fromString "indigo"               = Indigo
214
    | fromString "blueviolet"           = BlueViolet
215
    | fromString "mediumpurple"         = MediumPurple
216
    | fromString "mediumslateblue"      = MediumSlateBlue
217
    | fromString "slateblue"            = SlateBlue
218
    | fromString "darkslateblue"        = DarkSlateBlue
219
    | fromString "lavender"             = Lavender
220
    | fromString "ghostwhite"           = GhostWhite
221
    | fromString "blue"                 = Blue
222
    | fromString "mediumblue"           = MediumBlue
223
    | fromString "midnightblue"         = MidnightBlue
224
    | fromString "darkblue"             = DarkBlue
225
    | fromString "navy"                 = Navy
226
    | fromString "royalblue"            = RoyalBlue
227
    | fromString "cornflowerblue"       = CornflowerBlue
228
    | fromString "lightsteelblue"       = LightSteelBlue
229
    | fromString "lightslategray"       = LightSlateGray
230
    | fromString "slategray"            = SlateGray
231
    | fromString "dodgerblue"           = DodgerBlue
232
    | fromString "aliceblue"            = AliceBlue
233
    | fromString "steelblue"            = SteelBlue
234
    | fromString "lightskyblue"         = LightSkyBlue
235
    | fromString "skyblue"              = SkyBlue
236
    | fromString "deepskyblue"          = DeepSkyBlue
237
    | fromString "lightblue"            = LightBlue
238
    | fromString "powderblue"           = PowderBlue
239
    | fromString "cadetblue"            = CadetBlue
240
    | fromString "azure"                = Azure
241
    | fromString "lightcyan"            = LightCyan
242
    | fromString "paleturquoise"        = PaleTurquoise
243
    | fromString "cyan"                 = Cyan
244
    | fromString "aqua"                 = Aqua
245
    | fromString "darkturquoise"        = DarkTurquoise
246
    | fromString "darkslategray"        = DarkSlateGray
247
    | fromString "darkcyan"             = DarkCyan
248
    | fromString "teal"                 = Teal
249
    | fromString "mediumturquoise"      = MediumTurquoise
250
    | fromString "lightseagreen"        = LightSeaGreen
251
    | fromString "turquoise"            = Turquoise
252
    | fromString "aquamarine"           = Aquamarine
253
    | fromString "mediumaquamarine"     = MediumAquamarine
254
    | fromString "mediumspringgreen"    = MediumSpringGreen
255
    | fromString "mintcream"            = MintCream
256
    | fromString "springgreen"          = SpringGreen
257
    | fromString "mediumseagreen"       = MediumSeaGreen
258
    | fromString "seagreen"             = SeaGreen
259
    | fromString "honeydew"             = Honeydew
260
    | fromString "lightgreen"           = LightGreen
261
    | fromString "palegreen"            = PaleGreen
262
    | fromString "darkseagreen"         = DarkSeaGreen
263
    | fromString "limegreen"            = LimeGreen
264
    | fromString "lime"                 = Lime
265
    | fromString "forestgreen"          = ForestGreen
266
    | fromString "green"                = Green
267
    | fromString "darkgreen"            = DarkGreen
268
    | fromString "chartreuse"           = Chartreuse
269
    | fromString "lawngreen"            = LawnGreen
270
    | fromString "greenyellow"          = GreenYellow
271
    | fromString "darkolivegreen"       = DarkOliveGreen
272
    | fromString "yellowgreen"          = YellowGreen
273
    | fromString "olivedrab"            = OliveDrab
274
    | fromString "beige"                = Beige
275
    | fromString "lightgoldenrodyellow" = LightGoldenrodYellow
276
    | fromString "ivory"                = Ivory
277
    | fromString "lightyellow"          = LightYellow
278
    | fromString "yellow"               = Yellow
279
    | fromString "olive"                = Olive
280
    | fromString "darkkhaki"            = DarkKhaki
281
    | fromString "lemonchiffon"         = LemonChiffon
282
    | fromString "palegoldenrod"        = PaleGoldenrod
283
    | fromString "khaki"                = Khaki
284
    | fromString "gold"                 = Gold
285
    | fromString "cornsilk"             = Cornsilk
286
    | fromString "goldenrod"            = Goldenrod
287
    | fromString "darkgoldenrod"        = DarkGoldenrod
288
    | fromString "floralwhite"          = FloralWhite
289
    | fromString "oldlace"              = OldLace
290
    | fromString "wheat"                = Wheat
291
    | fromString "moccasin"             = Moccasin
292
    | fromString "orange"               = Orange
293
    | fromString "papayawhip"           = PapayaWhip
294
    | fromString "blanchedalmond"       = BlanchedAlmond
295
    | fromString "navajowhite"          = NavajoWhite
296
    | fromString "antiquewhite"         = AntiqueWhite
297
    | fromString "tan"                  = Tan
298
    | fromString "burlywood"            = BurlyWood
299
    | fromString "bisque"               = Bisque
300
    | fromString "darkorange"           = DarkOrange
301
    | fromString "linen"                = Linen
302
    | fromString "peru"                 = Peru
303
    | fromString "peachpuff"            = PeachPuff
304
    | fromString "sandybrown"           = SandyBrown
305
    | fromString "chocolate"            = Chocolate
306
    | fromString "saddlebrown"          = SaddleBrown
307
    | fromString "seashell"             = Seashell
308
    | fromString "sienna"               = Sienna
309
    | fromString "lightsalmon"          = LightSalmon
310
    | fromString "coral"                = Coral
311
    | fromString "orangered"            = OrangeRed
312
    | fromString "darksalmon"           = DarkSalmon
313
    | fromString "tomato"               = Tomato
314
    | fromString "mistyrose"            = MistyRose
315
    | fromString "salmon"               = Salmon
316
    | fromString "snow"                 = Snow
317
    | fromString "lightcoral"           = LightCoral
318
    | fromString "rosybrown"            = RosyBrown
319
    | fromString "indianred"            = IndianRed
320
    | fromString "red"                  = Red
321
    | fromString "brown"                = Brown
322
    | fromString "firebrick"            = FireBrick
323
    | fromString "darkred"              = DarkRed
324
    | fromString "maroon"               = Maroon
325
    | fromString "white"                = White
326
    | fromString "whitesmoke"           = WhiteSmoke
327
    | fromString "gainsboro"            = Gainsboro
328
    | fromString "lightgrey"            = LightGrey
329
    | fromString "silver"               = Silver
330
    | fromString "darkgray"             = DarkGray
331
    | fromString "gray"                 = Gray
332
    | fromString "dimgray"              = DimGray
333
    | fromString "black"                = Black
334
    | fromString _ = raise Fail "X11Color.fromString: unrecognized color name"
335
 
336
  fun toRGB LightPink                   = {red=0xff, green=0xb6, blue=0xc1}
337
    | toRGB Pink                        = {red=0xff, green=0xc0, blue=0xcb}
338
    | toRGB Crimson                     = {red=0xdc, green=0x14, blue=0x3c}
339
    | toRGB LavenderBlush               = {red=0xff, green=0xf0, blue=0xf5}
340
    | toRGB PaleVioletRed               = {red=0xdb, green=0x70, blue=0x93}
341
    | toRGB HotPink                     = {red=0xff, green=0x69, blue=0xb4}
342
    | toRGB DeepPink                    = {red=0xff, green=0x14, blue=0x93}
343
    | toRGB MediumVioletRed             = {red=0xc7, green=0x15, blue=0x85}
344
    | toRGB Orchid                      = {red=0xda, green=0x70, blue=0xd6}
345
    | toRGB Thistle                     = {red=0xd8, green=0xbf, blue=0xd8}
346
    | toRGB Plum                        = {red=0xdd, green=0xa0, blue=0xdd}
347
    | toRGB Violet                      = {red=0xee, green=0x82, blue=0xee}
348
    | toRGB Magenta                     = {red=0xff, green=0x00, blue=0xff}
349
    | toRGB Fuchsia                     = {red=0xff, green=0x00, blue=0xff}
350
    | toRGB DarkMagenta                 = {red=0x8b, green=0x00, blue=0x8b}
351
    | toRGB Purple                      = {red=0x80, green=0x00, blue=0x80}
352
    | toRGB MediumOrchid                = {red=0xba, green=0x55, blue=0xd3}
353
    | toRGB DarkViolet                  = {red=0x94, green=0x00, blue=0xd3}
354
    | toRGB DarkOrchid                  = {red=0x99, green=0x32, blue=0xcc}
355
    | toRGB Indigo                      = {red=0x4b, green=0x00, blue=0x82}
356
    | toRGB BlueViolet                  = {red=0x8a, green=0x2b, blue=0xe2}
357
    | toRGB MediumPurple                = {red=0x93, green=0x70, blue=0xdb}
358
    | toRGB MediumSlateBlue             = {red=0x7b, green=0x68, blue=0xee}
359
    | toRGB SlateBlue                   = {red=0x6a, green=0x5a, blue=0xcd}
360
    | toRGB DarkSlateBlue               = {red=0x48, green=0x3d, blue=0x8b}
361
    | toRGB Lavender                    = {red=0xe6, green=0xe6, blue=0xfa}
362
    | toRGB GhostWhite                  = {red=0xf8, green=0xf8, blue=0xff}
363
    | toRGB Blue                        = {red=0x00, green=0x00, blue=0xff}
364
    | toRGB MediumBlue                  = {red=0x00, green=0x00, blue=0xcd}
365
    | toRGB MidnightBlue                = {red=0x19, green=0x19, blue=0x70}
366
    | toRGB DarkBlue                    = {red=0x00, green=0x00, blue=0x8b}
367
    | toRGB Navy                        = {red=0x00, green=0x00, blue=0x80}
368
    | toRGB RoyalBlue                   = {red=0x41, green=0x69, blue=0xe1}
369
    | toRGB CornflowerBlue              = {red=0x64, green=0x95, blue=0xed}
370
    | toRGB LightSteelBlue              = {red=0xb0, green=0xc4, blue=0xde}
371
    | toRGB LightSlateGray              = {red=0x77, green=0x88, blue=0x99}
372
    | toRGB SlateGray                   = {red=0x70, green=0x80, blue=0x90}
373
    | toRGB DodgerBlue                  = {red=0x1e, green=0x90, blue=0xff}
374
    | toRGB AliceBlue                   = {red=0xf0, green=0xf8, blue=0xff}
375
    | toRGB SteelBlue                   = {red=0x46, green=0x82, blue=0xb4}
376
    | toRGB LightSkyBlue                = {red=0x87, green=0xce, blue=0xfa}
377
    | toRGB SkyBlue                     = {red=0x87, green=0xce, blue=0xeb}
378
    | toRGB DeepSkyBlue                 = {red=0x00, green=0xbf, blue=0xff}
379
    | toRGB LightBlue                   = {red=0xad, green=0xd8, blue=0xe6}
380
    | toRGB PowderBlue                  = {red=0xb0, green=0xe0, blue=0xe6}
381
    | toRGB CadetBlue                   = {red=0x5f, green=0x9e, blue=0xa0}
382
    | toRGB Azure                       = {red=0xf0, green=0xff, blue=0xff}
383
    | toRGB LightCyan                   = {red=0xe0, green=0xff, blue=0xff}
384
    | toRGB PaleTurquoise               = {red=0xaf, green=0xee, blue=0xee}
385
    | toRGB Cyan                        = {red=0x00, green=0xff, blue=0xff}
386
    | toRGB Aqua                        = {red=0x00, green=0xff, blue=0xff}
387
    | toRGB DarkTurquoise               = {red=0x00, green=0xce, blue=0xd1}
388
    | toRGB DarkSlateGray               = {red=0x2f, green=0x4f, blue=0x4f}
389
    | toRGB DarkCyan                    = {red=0x00, green=0x8b, blue=0x8b}
390
    | toRGB Teal                        = {red=0x00, green=0x80, blue=0x80}
391
    | toRGB MediumTurquoise             = {red=0x48, green=0xd1, blue=0xcc}
392
    | toRGB LightSeaGreen               = {red=0x20, green=0xb2, blue=0xaa}
393
    | toRGB Turquoise                   = {red=0x40, green=0xe0, blue=0xd0}
394
    | toRGB Aquamarine                  = {red=0x7f, green=0xff, blue=0xd4}
395
    | toRGB MediumAquamarine            = {red=0x66, green=0xcd, blue=0xaa}
396
    | toRGB MediumSpringGreen           = {red=0x00, green=0xfa, blue=0x9a}
397
    | toRGB MintCream                   = {red=0xf5, green=0xff, blue=0xfa}
398
    | toRGB SpringGreen                 = {red=0x00, green=0xff, blue=0x7f}
399
    | toRGB MediumSeaGreen              = {red=0x3c, green=0xb3, blue=0x71}
400
    | toRGB SeaGreen                    = {red=0x2e, green=0x8b, blue=0x57}
401
    | toRGB Honeydew                    = {red=0xf0, green=0xff, blue=0xf0}
402
    | toRGB LightGreen                  = {red=0x90, green=0xee, blue=0x90}
403
    | toRGB PaleGreen                   = {red=0x98, green=0xfb, blue=0x98}
404
    | toRGB DarkSeaGreen                = {red=0x8f, green=0xbc, blue=0x8f}
405
    | toRGB LimeGreen                   = {red=0x32, green=0xcd, blue=0x32}
406
    | toRGB Lime                        = {red=0x00, green=0xff, blue=0x00}
407
    | toRGB ForestGreen                 = {red=0x22, green=0x8b, blue=0x22}
408
    | toRGB Green                       = {red=0x00, green=0x80, blue=0x00}
409
    | toRGB DarkGreen                   = {red=0x00, green=0x64, blue=0x00}
410
    | toRGB Chartreuse                  = {red=0x7f, green=0xff, blue=0x00}
411
    | toRGB LawnGreen                   = {red=0x7c, green=0xfc, blue=0x00}
412
    | toRGB GreenYellow                 = {red=0xad, green=0xff, blue=0x2f}
413
    | toRGB DarkOliveGreen              = {red=0x55, green=0x6b, blue=0x2f}
414
    | toRGB YellowGreen                 = {red=0x9a, green=0xcd, blue=0x32}
415
    | toRGB OliveDrab                   = {red=0x6b, green=0x8e, blue=0x23}
416
    | toRGB Beige                       = {red=0xf5, green=0xf5, blue=0xdc}
417
    | toRGB LightGoldenrodYellow        = {red=0xfa, green=0xfa, blue=0xd2}
418
    | toRGB Ivory                       = {red=0xff, green=0xff, blue=0xf0}
419
    | toRGB LightYellow                 = {red=0xff, green=0xff, blue=0xe0}
420
    | toRGB Yellow                      = {red=0xff, green=0xff, blue=0x00}
421
    | toRGB Olive                       = {red=0x80, green=0x80, blue=0x00}
422
    | toRGB DarkKhaki                   = {red=0xbd, green=0xb7, blue=0x6b}
423
    | toRGB LemonChiffon                = {red=0xff, green=0xfa, blue=0xcd}
424
    | toRGB PaleGoldenrod               = {red=0xee, green=0xe8, blue=0xaa}
425
    | toRGB Khaki                       = {red=0xf0, green=0xe6, blue=0x8c}
426
    | toRGB Gold                        = {red=0xff, green=0xd7, blue=0x00}
427
    | toRGB Cornsilk                    = {red=0xff, green=0xf8, blue=0xdc}
428
    | toRGB Goldenrod                   = {red=0xda, green=0xa5, blue=0x20}
429
    | toRGB DarkGoldenrod               = {red=0xb8, green=0x86, blue=0x0b}
430
    | toRGB FloralWhite                 = {red=0xff, green=0xfa, blue=0xf0}
431
    | toRGB OldLace                     = {red=0xfd, green=0xf5, blue=0xe6}
432
    | toRGB Wheat                       = {red=0xf5, green=0xde, blue=0xb3}
433
    | toRGB Moccasin                    = {red=0xff, green=0xe4, blue=0xb5}
434
    | toRGB Orange                      = {red=0xff, green=0xa5, blue=0x00}
435
    | toRGB PapayaWhip                  = {red=0xff, green=0xef, blue=0xd5}
436
    | toRGB BlanchedAlmond              = {red=0xff, green=0xeb, blue=0xcd}
437
    | toRGB NavajoWhite                 = {red=0xff, green=0xde, blue=0xad}
438
    | toRGB AntiqueWhite                = {red=0xfa, green=0xeb, blue=0xd7}
439
    | toRGB Tan                         = {red=0xd2, green=0xb4, blue=0x8c}
440
    | toRGB BurlyWood                   = {red=0xde, green=0xb8, blue=0x87}
441
    | toRGB Bisque                      = {red=0xff, green=0xe4, blue=0xc4}
442
    | toRGB DarkOrange                  = {red=0xff, green=0x8c, blue=0x00}
443
    | toRGB Linen                       = {red=0xfa, green=0xf0, blue=0xe6}
444
    | toRGB Peru                        = {red=0xcd, green=0x85, blue=0x3f}
445
    | toRGB PeachPuff                   = {red=0xff, green=0xda, blue=0xb9}
446
    | toRGB SandyBrown                  = {red=0xf4, green=0xa4, blue=0x60}
447
    | toRGB Chocolate                   = {red=0xd2, green=0x69, blue=0x1e}
448
    | toRGB SaddleBrown                 = {red=0x8b, green=0x45, blue=0x13}
449
    | toRGB Seashell                    = {red=0xff, green=0xf5, blue=0xee}
450
    | toRGB Sienna                      = {red=0xa0, green=0x52, blue=0x2d}
451
    | toRGB LightSalmon                 = {red=0xff, green=0xa0, blue=0x7a}
452
    | toRGB Coral                       = {red=0xff, green=0x7f, blue=0x50}
453
    | toRGB OrangeRed                   = {red=0xff, green=0x45, blue=0x00}
454
    | toRGB DarkSalmon                  = {red=0xe9, green=0x96, blue=0x7a}
455
    | toRGB Tomato                      = {red=0xff, green=0x63, blue=0x47}
456
    | toRGB MistyRose                   = {red=0xff, green=0xe4, blue=0xe1}
457
    | toRGB Salmon                      = {red=0xfa, green=0x80, blue=0x72}
458
    | toRGB Snow                        = {red=0xff, green=0xfa, blue=0xfa}
459
    | toRGB LightCoral                  = {red=0xf0, green=0x80, blue=0x80}
460
    | toRGB RosyBrown                   = {red=0xbc, green=0x8f, blue=0x8f}
461
    | toRGB IndianRed                   = {red=0xcd, green=0x5c, blue=0x5c}
462
    | toRGB Red                         = {red=0xff, green=0x00, blue=0x00}
463
    | toRGB Brown                       = {red=0xa5, green=0x2a, blue=0x2a}
464
    | toRGB FireBrick                   = {red=0xb2, green=0x22, blue=0x22}
465
    | toRGB DarkRed                     = {red=0x8b, green=0x00, blue=0x00}
466
    | toRGB Maroon                      = {red=0x80, green=0x00, blue=0x00}
467
    | toRGB White                       = {red=0xff, green=0xff, blue=0xff}
468
    | toRGB WhiteSmoke                  = {red=0xf5, green=0xf5, blue=0xf5}
469
    | toRGB Gainsboro                   = {red=0xdc, green=0xdc, blue=0xdc}
470
    | toRGB LightGrey                   = {red=0xd3, green=0xd3, blue=0xd3}
471
    | toRGB Silver                      = {red=0xc0, green=0xc0, blue=0xc0}
472
    | toRGB DarkGray                    = {red=0xa9, green=0xa9, blue=0xa9}
473
    | toRGB Gray                        = {red=0x80, green=0x80, blue=0x80}
474
    | toRGB DimGray                     = {red=0x69, green=0x69, blue=0x69}
475
    | toRGB Black                       = {red=0x00, green=0x00, blue=0x00}
476
 
477
  local
478
    fun readint ss = valOf (Int.scan StringCvt.HEX Substring.getc ss)
479
  in
480
  fun rgbFromString s = if size s <> 7 then NONE
481
                   else let
482
                     val ss = Substring.full s
483
                     val f = valOf (Substring.first ss)
484
                     val (r, _) = readint (Substring.slice (ss, 1, SOME 2))
485
                     val (g, _) = readint (Substring.slice (ss, 3, SOME 2))
486
                     val (b, _) = readint (Substring.slice (ss, 5, SOME 2))
487
                   in if f= #"#" then SOME {red=r,green=g,blue=b} else NONE end
488
                   handle Option => NONE
489
  end (* local *)
490
 
491
end
492