blob: 9dcbed6c03c8f00c2e81bdf763a98fd6046ea26d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
############################################################################
#
# File: clrutils.icn
#
# Subject: Procedures to convert color formats
#
# Author: Ralph E. Griswold
#
# Date: September 17, 1998
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# These procedures convert between comma-separated Icon color
# specifications and a record with r, g, and b fields.
#
############################################################################
record RGB(r, g, b)
procedure colortorgb(color) #: rgb record for color
local rgb
rgb := RGB()
color ? {
rgb.r := tab(upto(',')) | fail
move(1)
rgb.g := tab(upto(',')) | fail
move(1)
rgb.b := tab(0)
}
return rgb
end
procedure rgbtocolor(rgb)
return rgb.r || "," || rgb.g || "," || rgb.b
end
|