summaryrefslogtreecommitdiff
path: root/ipl/gprocs/colrlist.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/gprocs/colrlist.icn')
-rw-r--r--ipl/gprocs/colrlist.icn63
1 files changed, 63 insertions, 0 deletions
diff --git a/ipl/gprocs/colrlist.icn b/ipl/gprocs/colrlist.icn
new file mode 100644
index 0000000..865cb34
--- /dev/null
+++ b/ipl/gprocs/colrlist.icn
@@ -0,0 +1,63 @@
+############################################################################
+#
+# File: colrlist.icn
+#
+# Subject: Procedures to produce list of colors
+#
+# Author: Ralph E. Griswold
+#
+# Date: November 24, 1996
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# colrlist(f) returns a list of the colors given in a file.
+#
+# colrplte(p) returns a list of colors for the palette p.
+#
+############################################################################
+#
+# Requires: Version 9 graphics
+#
+############################################################################
+#
+# Links: io
+#
+############################################################################
+
+link io
+
+procedure colrlist(f) #: list of colors from file
+ local input, colors, line
+
+ if f === "-" then input := &input
+ else (input := dopen(f)) | fail
+ colors := []
+
+ while line := read(input) do
+ put(colors, ColorValue(line ? tab(upto('\t') | 0)))
+
+ close(input)
+
+ if *colors = 0 then fail
+
+ return colors
+
+end
+
+procedure colrplte(p) #: list of colors from palette
+ local colors
+
+ colors := []
+
+ every put(colors, PaletteColor(p, !PaletteChars(p)))
+
+ if *colors = 0 then fail # invalid palette
+
+ return colors
+
+
+end