############################################################################ # # File: colrpick.icn # # Subject: Program to pick RGB or HSV colors # # Author: Gregg M. Townsend # # Date: February 27, 1995 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # colrpick provides a command-level interface to the ColorDialog # procedure. The ColorValue() of the selected color is written to # standard output when the Okay button is pressed. If the Cancel # button is pressed, colorpick exits with an error by calling stop(). # # A default color can be specified by one or more command arguments, # for example "colrpick deep green". # ############################################################################ # # Requires: Version 9 graphics # ############################################################################ # # Links: graphics, vsetup # ############################################################################ link graphics link vsetup procedure main(args) local dflt Window ! put(ui_atts(), "canvas=hidden", args) ui() # just to get standard VIB font if *args > 0 then { dflt := "" every dflt ||:= " " || !args if not ColorValue(dflt) then { write(&errout, " illegal default color: ", dflt) dflt := &null } } case ColorDialog(, dflt) of { "Okay": write(dialog_value) "Cancel": stop() } end #===<>=== modify using vib; do not remove this marker line procedure ui_atts() return ["size=340,320", "bg=pale gray"] end procedure ui(win, cbk) return vsetup(win, cbk, [":Sizer:::0,0,340,320:",], ) end #===<>=== end of section maintained by vib