; $Header: /usr/build/vile/vile/macros/RCS/palettes.rc,v 1.8 2008/07/26 17:51:46 tom Exp $
; Sample color schemes.

~if &not &error $ncolors
; Note that while the palette strings reference up to 16 colors, you will have
; only 8 available if vile is linked with termcap.  To get 16 colors, you need
; terminfo (e.g., ncurses), and a terminal emulator that supports 16 colors.

~local %palette
~local %dark-palette
~local %light-palette

set color-scheme=default
setv %dark-palette " "
setv %light-palette ""
setv %palette 0
~while &less %palette $ncolors
	~if &or &equal %palette 3 &equal %palette 11
		setv %light-palette &cat %light-palette &cat " " &word &add 1 %palette $palette
		setv %dark-palette  &cat %dark-palette  &cat " " &word %palette $palette
	~elseif &or &equal %palette 4 &equal %palette 12
		setv %light-palette &cat %light-palette &cat " " &word %palette $palette
		setv %dark-palette  &cat %dark-palette  &cat " " &word &sub %palette 1 $palette
	~else
		setv %light-palette &cat %light-palette &cat " " &word %palette $palette
		setv %dark-palette  &cat %dark-palette  &cat " " &word %palette $palette
	~endif
	setv %palette &add %palette 1
~endwhile

; Note:  if we are using the default, or system colors, it is generally not
; possible to determine what their values are.  The "light" and "dark" schemes
; use default colors.
~with define-color-scheme

	; on a light background, we don't like to use yellow - map it to blue
	light use=default palette=%light-palette

	; on a dark background, we don't like to use blue - map it to yellow
	dark  use=default palette=%dark-palette

	reverse video-attr=rev

	white use=dark fcolor=white bcolor=black

	black use=light bcolor=white fcolor=black

~endwith
~endif
