diff options
| author | murphy <murphy@rubychan.de> | 2010-01-22 02:25:34 +0000 |
|---|---|---|
| committer | murphy <murphy@rubychan.de> | 2010-01-22 02:25:34 +0000 |
| commit | b042c57cedf7461aaad41b953d3e61bcf1ee647a (patch) | |
| tree | b992058b9fd89225fcb3648faec54dfebadcdc76 /etc/ansi-color | |
| parent | 88a7c8532f3f86206c25c40b81fc2e25f6ae2593 (diff) | |
| download | coderay-b042c57cedf7461aaad41b953d3e61bcf1ee647a.tar.gz | |
Added some coderay statistic scripts, and ansi-color experiments from
http://frexx.de/xterm-256-notes/.
Diffstat (limited to 'etc/ansi-color')
| -rw-r--r-- | etc/ansi-color/256colors2.pl | 63 | ||||
| -rw-r--r-- | etc/ansi-color/colortable16.sh | 48 |
2 files changed, 111 insertions, 0 deletions
diff --git a/etc/ansi-color/256colors2.pl b/etc/ansi-color/256colors2.pl new file mode 100644 index 0000000..c97c2be --- /dev/null +++ b/etc/ansi-color/256colors2.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl +# Author: Todd Larason <jtl@molehill.org> +# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ + +# use the resources for colors 0-15 - usually more-or-less a +# reproduction of the standard ANSI colors, but possibly more +# pleasing shades + +# colors 16-231 are a 6x6x6 color cube +for ($red = 0; $red < 6; $red++) { + for ($green = 0; $green < 6; $green++) { + for ($blue = 0; $blue < 6; $blue++) { + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 16 + ($red * 36) + ($green * 6) + $blue, + ($red ? ($red * 40 + 55) : 0), + ($green ? ($green * 40 + 55) : 0), + ($blue ? ($blue * 40 + 55) : 0)); + } + } +} + +# colors 232-255 are a grayscale ramp, intentionally leaving out +# black and white +for ($gray = 0; $gray < 24; $gray++) { + $level = ($gray * 10) + 8; + printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + 232 + $gray, $level, $level, $level); +} + + +# display the colors + +# first the system ones: +print "System colors:\n"; +for ($color = 0; $color < 8; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; +for ($color = 8; $color < 16; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n\n"; + +# now the color cube +print "Color cube, 6x6x6:\n"; +for ($green = 0; $green < 6; $green++) { + for ($red = 0; $red < 6; $red++) { + for ($blue = 0; $blue < 6; $blue++) { + $color = 16 + ($red * 36) + ($green * 6) + $blue; + print "\x1b[48;5;${color}m "; + } + print "\x1b[0m "; + } + print "\n"; +} + + +# now the grayscale ramp +print "Grayscale ramp:\n"; +for ($color = 232; $color < 256; $color++) { + print "\x1b[48;5;${color}m "; +} +print "\x1b[0m\n"; diff --git a/etc/ansi-color/colortable16.sh b/etc/ansi-color/colortable16.sh new file mode 100644 index 0000000..6281628 --- /dev/null +++ b/etc/ansi-color/colortable16.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Description: +# +# Prints a color table of 8bg * 8fg * 2 states (regular/bold) +# +# Copyright: +# +# (C) 2009 Wolfgang Frisch <xororand@unfoog.de> +# +# License: +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +echo +echo Table for 16-color terminal escape sequences. +echo Replace ESC with \\033 in bash. +echo +echo "Background | Foreground colors" +echo "---------------------------------------------------------------------" +for((bg=40;bg<=47;bg++)); do + for((bold=0;bold<=1;bold++)) do + echo -en "\033[0m"" ESC[${bg}m | " + for((fg=30;fg<=37;fg++)); do + if [ $bold == "0" ]; then + echo -en "\033[${bg}m\033[${fg}m [${fg}m " + else + echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m" + fi + done + echo -e "\033[0m" + done + echo "--------------------------------------------------------------------- " +done + +echo +echo |
