home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d01xx / d0151.lha / SCT / sct.doc < prev    next >
Text File  |  1987-06-15  |  9KB  |  203 lines

  1. SetColorTable (or SCT for short) is a CLI-based utility for displaying and/or
  2. setting a screen's colors.  It will allow you to change any or all of the
  3. colors for any screen whose "Screen Title" you know.  You can save the colors
  4. of a screen to be restored later, or easily copy one screen's colors to another.
  5. It works by creating an array of ColorTable entries and calling LoadRGB4.
  6.  
  7. SetColorTable is Copyright 1988 by aklevin.  All rights reserved.
  8. I copyrighted this because of all the talk of copyrighting, copy"wronging",
  9. and such on USENET.  SCT may not be sold without my express written permission.
  10. SCT may, however, be copied and distributed in a not-for-profit manner.
  11.  
  12.  
  13. First an explanation of color values as they pertain to SCT:
  14.  
  15. Color values are specified as a four digit hexadecimal number (Xrgb) using
  16. the following convention:
  17.  
  18. Each of r, g, and b (red, green, and blue) is a hexadecimal digit ranging
  19. from 0 (none of that color) to f (the full amount of that color).
  20. So, as examples, black=000, medium red=800, yellow=ff0,  white=fff.
  21. The first digit (X) is an indicator flag.  If this digit is 0 (or is omitted),
  22. the rest of the number will be used as a color value to alter an entry in the
  23. ColorTable.  If this digit is a 1, it indicates that this value is to be
  24. skipped, it is only a placeholder to keep remaining values in sync.
  25. If this digit is a 2, it indicates that this value is to be skipped,
  26. and that there are no more values to be changed.  It is used when a less-
  27. then-complete set of color values is being entered from stdin.
  28.  
  29. As an example, the Workbench screen has four colors,
  30. and so has four entries in it's ColorTable:
  31.  
  32.   +- Background color (blue)
  33.   |    +- Text color (white)
  34.   |    |    +- Highlight color (near-black)
  35.   |    |    |    +- Cursor color (orange)
  36.   |    |    |    |
  37.   V    V    V    V
  38.  RGB  RGB  RGB  RGB
  39.  05a  fff  002  f80   <- These are the RGB values for each ColorTable entry.
  40.  
  41. The default Workbench colors would be given to SCT with:
  42. "SCT 005a 0fff 0002 0f80".
  43.  
  44. Other screens may have more colors than this.  You can find out by typing:
  45. "SCT 2000" which will display the RGB value for each entry the table has.
  46. The `2' in `2000', as explained above, makes that value a flag which tells
  47. SCT that there are no more RGB values to be read in.  Since it is the only
  48. value given, SCT won't change *any* entries.
  49.  
  50. There are two ways that SCT can get it's RGB values: from the command line,
  51. and from stdin (standard input).  You should use command line input when you
  52. know explicitly how you want to change the ColorTable.  You should use stdin
  53. when the ColorTable values are in a file, and you want SCT to get them from
  54. there.  Each way will be discussed separately.
  55.  
  56. Input from the Command Line:
  57.  
  58. SCT Xrgb Xrgb Xrgb...
  59. This instructs SCT to change the first N entries in the Workbench Screen's
  60. ColorTable (where N = the number of RGB values typed).  The Workbench Screen
  61. has four colors; if you type fewer than four, only that many entries will
  62. get modified.  If you type more than four, the extra ones are ignored.
  63. Remember that the X in each of those rgb values stands for an indicator flag.
  64. So, a value of 0f8f (or f8f) means "use this value to change the corresponding
  65. ColorTable entry to pink".  A value of 1f8f (or 1000, or any four-digit number
  66. beginning with a `1') means "ignore this value, but keep going".  You'd use
  67. this if you wanted to change one entry without disturbing previous ones.
  68.  
  69. For example, suppose that your Workbench Screen's colors are currently
  70. 357 fff 000 0bd, and you want to change the highlight color (third entry)
  71. from black (000) to white (fff).  You could type "SCT 0357 0fff 0fff 00bd"
  72. and that would work.  But now suppose that you didn't know what any of the
  73. four values were to begin with (you could use "SCT 2000" to find out, but
  74. bear with me).  Then you can use "SCT 1000 1000 0fff 1000" and only the third
  75. entry will be changed.  In fact, you can leave out the last `1000' since with
  76. command line input, SCT only changes as many entries as it has values.
  77.  
  78. SCT >colorfile Xrgb Xrgb Xrgb...
  79. As above, but rather than printing the Workbench Screen's colors, SCT puts
  80. them in the file called `colorfile'.  Later, using the stdin form of SCT,
  81. they can be read back in.  If you don't want the current values printed out,
  82. and also don't want them sent to a file, use "SCT >NIL: Xrgb Xrgb Xrgb... ".
  83.  
  84. SCT -t "Screen Title" Xrgb Xrgb Xrgb...
  85. Like "SCT Xrgb Xrgb Xrgb... " above, but instead of operating on the
  86. Workbench Screen, SCT searches for a screen whose title is "Screen Title"
  87. and displays and/or changes the ColorTable for it.  Note that you must know
  88. the exact title of the screen to specify it to SCT.  Some screens don't show
  89. their title, some screens don't even have a title.  I have included another
  90. little utility I wrote called `Cruise', which will show you the titles of all
  91. open screens and their windows.  From that you can probably tell whether or
  92. not your screen has a title.  If it doesn't, you can either give up, or modify
  93. SCT.c to default to the ActiveScreen (sic), rather than the Workbench Screen.
  94. I recommend the latter approach, and I'd like to see your work if you
  95. do it.  Also note that screens other than the Workbench Screen
  96. can have 2, 4, 8, 16 or 32 ColorTable entries.
  97.  
  98. SCT >colorfile -t "Screen Title" Xrgb Xrgb Xrgb...
  99. As above, but rather than printing the "Screen Title" screen's colors, SCT
  100. puts them in the file called `colorfile'.  Later, using the stdin form of SCT,
  101. they can be read back in.  If you don't want the current values printed out,
  102. and also don't want them sent to a file, use "SCT >NIL: Xrgb Xrgb Xrgb... .
  103.  
  104.  
  105. Input from Stdin:
  106.  
  107. SCT <colorfile
  108. Like "SCT Xrgb Xrgb Xrgb..." above, but instead of receiving the RGB values
  109. from the command line, SCT gets them from the file `colorfile'.
  110. Values can be one to a line or separated by spaces.
  111.  
  112. SCT <colorfile -t "Screen Title"
  113. Like "SCT -t "Screen Title" Xrgb Xrgb Xrgb..." above, but instead of receiving
  114. the RGB values from the command line, SCT gets them from the file `colorfile'.
  115.  
  116.  
  117. Please note that when you use " >file", " <file" or " >NIL:" (this is known
  118. as input and output redirection) it must come before any Xrgb values, as well
  119. as a screen title option, so "SCT 2000 -t "A Title" >NIL:" won't work.
  120.  
  121.  
  122. Now for some useful examples:
  123.  
  124. There are some programs out there that don't look too good with the Workbench
  125. colors I choose to use.  As a matter of fact, there are some programs that
  126. don't look too good even with the default Workbench colors.
  127. There are also some programs for which I always find myself calling up
  128. `Preferences' to change the colors so that the text that looked good with the
  129. programmer's Workbench colors is readable with mine.  I quickly got tired of
  130. that, and wrote SCT.  Now I have a command script with:
  131.  
  132. SCT >t:colors 1000 00bd
  133. Here I call the program.
  134. SCT >NIL: <t:colors
  135.  
  136. The first line saves the current colors in a temporary file and then
  137. changes the text color of the Workbench screen to a light blue.
  138. The second line starts up the program that used to look bad.  When it is done
  139. executing, the third line restores the saved colors from t:colors.
  140.  
  141.  
  142. To display the Workbench color values:
  143.  
  144. SCT 2000
  145.  
  146. The 2000 is used to indicate that no colors are to be changed.
  147.  
  148.  
  149. To copy the colors from one screen to another:
  150.  
  151. SCT >NiceColors -t "Nice Screen" 2000
  152. SCT >NIL: <NiceColors -t "Other Screen"
  153.  
  154. The first line saves the colors of the screen whose title is "Nice Screen"
  155. in the file NiceColors.  The second line "restores" the colors of the screen
  156. whose title is "Other Screen" using the contents of NiceColors.
  157.  
  158.  
  159. To swap the colors of two screens:
  160.  
  161. SCT >ColorA -t "Screen A" 2000
  162. SCT >ColorB <ColorA -t "Screen B"
  163. SCT >NIL: <ColorB -t "Screen A"
  164.  
  165. (You can probably figure these out on your own by now, eh?)
  166. Keep in mind that if the two screens do not have the same number of colors,
  167. the one with more will end up with those extra colors unchanged.
  168.  
  169.  
  170. To swap the colors of two screens regardless of the number of colors:
  171. (The ColorTable is repeated to make up the difference.)
  172.  
  173. SCT >ColorA -t "Screen A" 2000
  174. join ColorA ColorA ColorA ColorA as temp
  175. join temp temp temp temp as ColorA
  176. SCT >ColorB <ColorA -t "Screen B"
  177. join ColorB ColorB ColorB ColorB as temp
  178. join temp temp temp temp as ColorB
  179. SCT >NIL: <ColorB -t "Screen A"
  180.  
  181. The first line saves the colors of "Screen A" in the file `ColorA'.
  182. There may be as few as two colors in this screen, so it must be
  183. duplicated 16 times to be *certain* of containing at least 32 entries
  184. (Remember, extra entries are ignored).
  185. The second and third lines duplicate it four times each, giving 32 = 2*4*4.
  186. The fourth line colors "Screen B" with these values, while saving
  187. "Screen B"'s colors in `ColorB'.
  188. The fifth and sixth lines duplicate the number of entries by 16.
  189. The seventh line colors "Screen A" with these values.
  190.  
  191.  
  192. A poor man's screen blanker:
  193.  
  194. SCT >t:SaveColors 0000 0000 0000 0000
  195. date ?
  196. SCT >NIL: <t:SaveColors
  197.  
  198. The first line saves the current colors and sets the screen to all black.
  199. The second line invokes the date command, and the question mark makes it wait
  200. for you to press return before executing.  Once that is done, the third line
  201. resets the saved colors.
  202.  
  203.