#!/bin/ksh ## ## SCRIPT NAME: get_Xcolor_RGBvals ## ## Where: in $FEDIR/scripts where FEDIR=/apps/nns_com/fea ## ########################################################################### ## PURPOSE: Presents a list-selector GUI with a list of X-colornames. ## When the user picks a color this script sends its three ## RGB values (in the range 0 to 255) to standard output. ## ## Runs an showrgb-awk-sort-uniq pipe ## to provide a sorted list of X-color-names ## in col#1 with RGBvals to the right. ## ## No embedded blanks in the names, and no duplicate names. ## ## Could use 'cat /usr/lib/X11/rgb.txt' in place of ## '/usr/bin/X11/showrgb'. ## ########################################################################### ## INPUT: ## Input to this script: No command-line arguments or environment variables. ## User selects from a list of Xcolors in a GUI. ## Output: 3 RGB values (0-255) to stdout. ## Or, if the Cancel button is hit, nothing to stdout. ########################################################################### ## CALLED BY: $FEDIR/tkGUIs/tk_setPalette_via_sliders3rgb.tk ## which is used in ## $FEDIR/scripts/screentool.chestdef in the script ## $FEDIR/scripts/screentools ########################################################################### ## MAINTENANCE HISTORY: ## Written by: B. Montandon 18Nov99 Based on $FEDIR/scripts/xcolors_list_uniq ## Updated by: B. Montandon 18Nov99 ########################################################################### if test "$FEDIR" = "" then FEDIR="/apps/nns_com/fea" fi . $FEDIR/scripts/set_localoutlist ############################################################################ ## NOTES ON WHAT DOES NOT WORK, ## in trying to compress spaces out of colornames: ## ## /usr/bin/X11/showrgb | cut -c12- ## Doesn't remove blanks. ## /usr/bin/X11/showrgb | cut -c12- | sort ## Doesn't remove blanks. ## ## /usr/bin/X11/showrgb | awk '{print $4 $5}' ## Doesn't show 3-word names ## --- like 'dark olive green' . ## ## /usr/bin/X11/showrgb | awk '{print $4 $5 $6}' | sort | uniq ## Doesn't ## show 4-word names --- like 'sgi very dark gray'. ## ## /usr/bin/X11/showrgb | awk '{print $4 $5 $6 $7}' | sort ## Doesn't ## remove dups. ############################################################################ # /usr/bin/X11/showrgb | awk '{print $4 $5 $6 $7 " " $1 " " $2 " " $3}' | \ /usr/bin/X11/showrgb | egrep -v 'grey|sgi|indigo|crimson' | \ awk '{print $4 $5 $6 $7 " " $1 " " $2 " " $3}' | \ sort | uniq > $OUTLIST COLORNAME=`$FEDIR/tkGUIs/list_selector_col1.tk $OUTLIST` grep "^$COLORNAME" $OUTLIST | awk '{print $2 " " $3 " " $4}'