summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2005-04-18 22:04:07 +0000
committerMichael Jennings <mej@kainx.org>2005-04-18 22:04:07 +0000
commit05469ad9f0a38302028edc456d388f0d42bbe035 (patch)
tree48c6acb346c54630cac4b1235de8232da8d40f59 /utils
parent4d779be4e2acaee8de9229e6caff5e1a110b077a (diff)
downloadeterm-05469ad9f0a38302028edc456d388f0d42bbe035.tar.gz
Mon Apr 18 18:00:17 2005 Michael Jennings (mej)
Applied a patch from Fredrik Svensson <fred@ludd.ltu.se> for 256-color support (a la xterm). I also renamed and imported a couple of his test scripts into utils/, and in playing around with them, I found and fixed an X server resource leak. Use Etpalette to view the 256-color palette. ---------------------------------------------------------------------- SVN revision: 14228
Diffstat (limited to 'utils')
-rwxr-xr-xutils/Etcolors109
-rwxr-xr-xutils/Etgen-color-cube33
-rwxr-xr-xutils/Etgen-color-cube-c31
-rwxr-xr-xutils/Etpalette45
4 files changed, 164 insertions, 54 deletions
diff --git a/utils/Etcolors b/utils/Etcolors
index 33c75f3..666aca4 100755
--- a/utils/Etcolors
+++ b/utils/Etcolors
@@ -14,63 +14,64 @@ echo "you have configured. You may need to widen your terminal to see it proper
echo
echo "FG BG"
echo "-- --"
-echo " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15"
+echo " 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15"
fgstyle=""
-for fg in 0 1 2 3 4 5 6 7 ; do
- line=" $fg "
- case $fg in
- 0) fg_esc=30 ;;
- 1) fg_esc=31 ;;
- 2) fg_esc=32 ;;
- 3) fg_esc=33 ;;
- 4) fg_esc=34 ;;
- 5) fg_esc=35 ;;
- 6) fg_esc=36 ;;
- 7) fg_esc=37 ;;
- esac
- for bgstyle in "" ";5"; do
- for bg in 0 1 2 3 4 5 6 7 ; do
- case $bg in
- 0) bg_esc=40 ;;
- 1) bg_esc=41 ;;
- 2) bg_esc=42 ;;
- 3) bg_esc=43 ;;
- 4) bg_esc=44 ;;
- 5) bg_esc=45 ;;
- 6) bg_esc=46 ;;
- 7) bg_esc=47 ;;
- esac
- line="${line}[${fg_esc};${bg_esc}${fgstyle}${bgstyle}m txt "
+for fg in 00 01 02 03 04 05 06 07 ; do
+ line="$fg "
+ case $fg in
+ 00) fg_esc=30 ;;
+ 01) fg_esc=31 ;;
+ 02) fg_esc=32 ;;
+ 03) fg_esc=33 ;;
+ 04) fg_esc=34 ;;
+ 05) fg_esc=35 ;;
+ 06) fg_esc=36 ;;
+ 07) fg_esc=37 ;;
+ esac
+ for bgstyle in "" ";5"; do
+ for bg in 00 01 02 03 04 05 06 07 ; do
+ case $bg in
+ 00) bg_esc=40 ;;
+ 01) bg_esc=41 ;;
+ 02) bg_esc=42 ;;
+ 03) bg_esc=43 ;;
+ 04) bg_esc=44 ;;
+ 05) bg_esc=45 ;;
+ 06) bg_esc=46 ;;
+ 07) bg_esc=47 ;;
+ esac
+ line="${line}[${fg_esc};${bg_esc}${fgstyle}${bgstyle}m @@ "
+ done
done
- done
- echo "$line"
+ echo "$line"
done
fgstyle=";1"
-for fg in 8 9 10 11 12 13 14 15 ; do
- case $fg in
- 8) fg_esc=30; line=" $fg " ;;
- 9) fg_esc=31; line=" $fg " ;;
- 10) fg_esc=32; line="$fg " ;;
- 11) fg_esc=33; line="$fg " ;;
- 12) fg_esc=34; line="$fg " ;;
- 13) fg_esc=35; line="$fg " ;;
- 14) fg_esc=36; line="$fg " ;;
- 15) fg_esc=37; line="$fg " ;;
- esac
- for bgstyle in "" ";5"; do
- for bg in 0 1 2 3 4 5 6 7 ; do
- case $bg in
- 0) bg_esc=40 ;;
- 1) bg_esc=41 ;;
- 2) bg_esc=42 ;;
- 3) bg_esc=43 ;;
- 4) bg_esc=44 ;;
- 5) bg_esc=45 ;;
- 6) bg_esc=46 ;;
- 7) bg_esc=47 ;;
- esac
- line="${line}[${fg_esc};${bg_esc}${fgstyle}${bgstyle}m txt "
+for fg in 08 09 10 11 12 13 14 15 ; do
+ line="$fg "
+ case $fg in
+ 08) fg_esc=30 ;;
+ 09) fg_esc=31 ;;
+ 10) fg_esc=32 ;;
+ 11) fg_esc=33 ;;
+ 12) fg_esc=34 ;;
+ 13) fg_esc=35 ;;
+ 14) fg_esc=36 ;;
+ 15) fg_esc=37 ;;
+ esac
+ for bgstyle in "" ";5"; do
+ for bg in 0 1 2 3 4 5 6 7 ; do
+ case $bg in
+ 0) bg_esc=40 ;;
+ 1) bg_esc=41 ;;
+ 2) bg_esc=42 ;;
+ 3) bg_esc=43 ;;
+ 4) bg_esc=44 ;;
+ 5) bg_esc=45 ;;
+ 6) bg_esc=46 ;;
+ 7) bg_esc=47 ;;
+ esac
+ line="${line}[${fg_esc};${bg_esc}${fgstyle}${bgstyle}m @@ "
+ done
done
- done
- echo "$line"
+ echo "$line"
done
diff --git a/utils/Etgen-color-cube b/utils/Etgen-color-cube
new file mode 100755
index 0000000..959072b
--- /dev/null
+++ b/utils/Etgen-color-cube
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+# Built from
+# Author: Todd Larason <jtl@molehill.org>
+# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
+# adapted to the special needs for Eterm by Fredrik Svensson <fred@ludd.ltu.se>
+
+
+$redmax = 1;
+$greenmax = 1;
+$bluemax = 2*3*2*3*2*3;
+# adjust if 255 color should be included use adj = 1. Not possible if any maxvalue is 1.
+$adj = 0;
+
+# colors 16-231 are a 6x6x6 color cube
+for ($red = 0; $red < $redmax; $red++) {
+ for ($green = 0; $green < $greenmax; $green++) {
+ for ($blue = 0; $blue < $bluemax; $blue++) {
+ printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\",
+ 16 + ($red * $greenmax * $bluemax) + ($green * $bluemax) + $blue,
+ int ($red * 255 / ($redmax - $adj) ),
+ int ($green * 255 / ($greenmax - $adj)),
+ int ($blue * 255 / ($bluemax - $adj )));
+ }
+ }
+}
+
+# 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);
+}
diff --git a/utils/Etgen-color-cube-c b/utils/Etgen-color-cube-c
new file mode 100755
index 0000000..9590fd5
--- /dev/null
+++ b/utils/Etgen-color-cube-c
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+# Built from
+# Author: Todd Larason <jtl@molehill.org>
+# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
+# adapted to the special needs for Eterm by Fredrik Svensson <fred@ludd.ltu.se>
+
+
+$redmax = 2*3;
+$greenmax = 2*3;
+$bluemax = 2*3;
+$adj = 0;
+
+# colors 16-231 are a 6x6x6 color cube
+for ($red = 0; $red < $redmax; $red++) {
+ for ($green = 0; $green < $greenmax; $green++) {
+ for ($blue = 0; $blue < $bluemax; $blue++) {
+ printf(" \"rgb:%2.2x/%2.2x/%2.2x\",\n",
+ int ($red * 255 / ($redmax - $adj) ),
+ int ($green * 255 / ($greenmax - $adj)),
+ int ($blue * 255 / ($bluemax - $adj )));
+ }
+ }
+}
+
+# colors 232-255 are a grayscale ramp, intentionally leaving out
+# black and white
+for ($gray = 0; $gray < 24; $gray++) {
+ $level = ($gray * 10) + 8;
+ printf(" \"rgb:%2.2x/%2.2x/%2.2x\",\n",
+ $level, $level, $level);
+}
diff --git a/utils/Etpalette b/utils/Etpalette
new file mode 100755
index 0000000..61dc89b
--- /dev/null
+++ b/utils/Etpalette
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+# Based on a script by
+# Author: Todd Larason <jtl@molehill.org>
+# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.1 1999/07/11 08:49:54 dawes Exp $
+# adapted to the special needs for Eterm by Fredrik Svensson <fred@ludd.ltu.se>
+
+# 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";
+
+print "Eterm special colors:\n";
+for ($color = 256; $color < 294; $color++) {
+ print "\x1b[48;5;${color}m ";
+}
+print "\x1b[0m\n";