: SETCOLOR  Set Standard ANSI Color Escape Codes  03/21/1996-10/15/1999
: ---------------------------------------------------------------------
: Copyright (C) 1996-1999 by Vladimir Veytsel             www.davar.net

: 1. Operation mode:
:    "?"  - Display SETCOLOR batch command text (Equivalent: "/")
:    ""   - Autodetect (4DOS) monitor type (color or mono CRT)
:           NB: Mono LCD monitor can't be autodetected!
:    "0"  - Cancel ANSI escape codes (turn Black-and-White)
:    "Z"  - Cancel ANSI escape codes (turn Black-and-White)
:    "C"  - Set ANSI escape codes for color    monitor
:    "M"  - Set ANSI escape codes for mono CRT monitor (television-like)
:    "L"  - Set ANSI escape codes for mono LCD monitor (calculator-like)
:    "H"  - Display ANSI color help and message samples
:           (anything except above mentioned is treated as help request)

:    Notes:

:     - CONFIG.SYS should contain ANSI.SYS installation line:
:       "DEVICE=C:\DOS\ANSI.SYS"             for native DOS boot
:       "DEVICE=C:\WINDOWS\COMMAND\ANSI.SYS" for Windows-95 DOS session

:     - CONFIG.NT  should contain ANSI.SYS installation line:
:       "DEVICE=C:\WINNT\SYSTEM32\ANSI.SYS"  for Windows-NT DOS session

:     - If ANSI.SYS is not installed, colors are deactivated

@ECHO %TR%

 IF %1.==/. .OR. %1.==?. (LIST %_BATCHNAME ^ QUIT)

 SET SCL=%1 ^ IF %SCL%.==. SET SCL=%@SUBSTR[%_MONITOR,0]
 SET SCL=%@UPPER[%SCL%]
 IFF %_ANSI==0 THEN
     @ECHO ANSI.SYS is not installed
     SET SCL=0
 ENDIFF

 IFF %SCL%.==0. .OR. %SCL%.==Z. THEN
     SET R=
     SET G=
     SET Y=
     SET B=
     SET M=
     SET C=
     SET W=
     SET D=
     @ECHO %S%Screen colors are deactivated
     QUIT
 ELSEIFF %SCL%.==C. .OR. %SCL%.==COLOR. THEN
     SET R=[1;31m  ^: Bright Red
     SET G=[1;32m  ^: Bright Green
     SET Y=[1;33m  ^: Bright Yellow
     SET B=[1;34m  ^: Bright Blue
     SET M=[1;35m  ^: Bright Magenta
     SET C=[1;36m  ^: Bright Cyan
     SET W=[1;37m  ^: Bright White
     SET D=[0m     ^: Gray (DOS regular)
     QUIT
 ELSEIFF %SCL%.==M. .OR. %SCL%.==MONO. THEN
:    Sample Mono CRT pattern follows:
     SET R=[1;37m  ^: Bright White
     SET G=[1;37m  ^: Bright White
     SET Y=[1;37m  ^: Bright White
     SET B=[1;37m  ^: Bright White
     SET M=[1;37m  ^: Bright White
     SET C=[1;37m  ^: Bright White
     SET W=[1;37m  ^: Bright White
     SET D=[0m     ^: Gray (DOS regular)
     QUIT
 ELSEIFF %SCL%.==L. THEN
:    Sample Mono LCD pattern follows:
     SET R=[1;37m  ^: Bright White
     SET G=[1;37m  ^: Bright White
     SET Y=[1;37m  ^: Bright White
     SET B=[1;37m  ^: Bright White
     SET M=[1;37m  ^: Bright White
     SET C=[1;37m  ^: Bright White
     SET W=[1;37m  ^: Bright White
     SET D=[0m     ^: Gray (DOS regular)
     QUIT
 ELSE
     CLS
     @ECHO %G%ANSI Codes Demo  (in Terms of Color Monitor)
     @ECHO --------------------------------------------
     @ECHO %R%Bright Red:      R  - Error message
     @ECHO %G%Bright Green:    G  - Title, info or disk name/letter
     @ECHO %Y%Bright Yellow:   Y  - Command name or text accent
     @ECHO %B%Bright Blue:     B  - Status message
     @ECHO %M%Bright Magenta:  M  - Error message highlight
     @ECHO %C%Bright Cyan:     C  - Key, status msg h/l or compl message
     @ECHO %W%Bright White:    W  - Request or text highlight
     @ECHO %D%Gray:            D  - DOS regular text
     @ECHO:
     @ECHO %G%Several examples follow:%D%
     @ECHO:
     @ECHO %W%Insert %G%DDDD %W%disk into floppy drive %G%A: %W%and hit %C%[Enter]%D%
     @ECHO %W%Hit %C%[Enter] %W%to play %Y%next %W%tune or %C%[Esc] %W%to %Y%quit%D%
     @ECHO %R%Wrong disk %M%XXXX %R%is inserted instead of requested %M%DDDD%D%
     @ECHO %R%Free space on disk %M%DDDD %R%is only %M%12 %R%Kilobytes%D%
     @ECHO %B%Batch command %C%tracing %B%mode is now %C%OFF%D%
     @ECHO %G%Execution will take some time, please wait...%D%
     @ECHO Reading source file(s)...
 ENDIFF
 UNSET SCL
