summaryrefslogtreecommitdiff
path: root/ipl/gprocs/clrutils.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/gprocs/clrutils.icn')
-rw-r--r--ipl/gprocs/clrutils.icn45
1 files changed, 45 insertions, 0 deletions
diff --git a/ipl/gprocs/clrutils.icn b/ipl/gprocs/clrutils.icn
new file mode 100644
index 0000000..9dcbed6
--- /dev/null
+++ b/ipl/gprocs/clrutils.icn
@@ -0,0 +1,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