From 93c5456a54893a8e648cd803abf202e80e9a93b0 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb Date: Sat, 31 Oct 2009 14:11:58 +0000 Subject: Update to xterm 250 --- app/xterm/vttests/256colors2.pl | 49 +++++++++++++++++++++++++++++++++------ app/xterm/vttests/88colors2.pl | 51 +++++++++++++++++++++++++++++++++++------ 2 files changed, 86 insertions(+), 14 deletions(-) (limited to 'app/xterm/vttests') diff --git a/app/xterm/vttests/256colors2.pl b/app/xterm/vttests/256colors2.pl index c97c2be9d..0aecc551d 100644 --- a/app/xterm/vttests/256colors2.pl +++ b/app/xterm/vttests/256colors2.pl @@ -1,20 +1,52 @@ #!/usr/bin/perl -# Author: Todd Larason -# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ - +# $XTermId: 256colors2.pl,v 1.9 2009/10/10 14:45:26 tom Exp $ +# Authors: Todd Larason +# Thomas E Dickey +# # use the resources for colors 0-15 - usually more-or-less a # reproduction of the standard ANSI colors, but possibly more # pleasing shades +use strict; + +use Getopt::Std; + +our ($opt_h, $opt_q, $opt_r); +&getopts('hqr') || die("Usage: $0 [-q] [-r]"); +die("Usage: $0 [options]\n +Options: + -h display this message + -q quieter output by merging all palette initialization + -r display the reverse of the usual palette +") if ( $opt_h); + +our ($red, $green, $blue); +our ($gray, $level, $color); + +sub map_cube($) { + my $value = $_[0]; + $value = (5 - $value) if defined($opt_r); + return $value; +} + +sub map_gray($) { + my $value = $_[0]; + $value = (23 - $value) if defined($opt_r); + return $value; +} + +printf("\x1b]4") if ($opt_q); # 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, + printf("\x1b]4") unless ($opt_q); + printf(";%d;rgb:%2.2x/%2.2x/%2.2x", + 16 + (map_cube($red) * 36) + (map_cube($green) * 6) + map_cube($blue), ($red ? ($red * 40 + 55) : 0), ($green ? ($green * 40 + 55) : 0), ($blue ? ($blue * 40 + 55) : 0)); + printf("\x1b\\") unless ($opt_q); } } } @@ -22,10 +54,13 @@ for ($red = 0; $red < 6; $red++) { # 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\\", + $level = (map_gray($gray) * 10) + 8; + printf("\x1b]4") unless ($opt_q); + printf(";%d;rgb:%2.2x/%2.2x/%2.2x", 232 + $gray, $level, $level, $level); + printf("\x1b\\") unless ($opt_q); } +printf("\x1b\\") if ($opt_q); # display the colors diff --git a/app/xterm/vttests/88colors2.pl b/app/xterm/vttests/88colors2.pl index 0e4c8f529..63d3f3a87 100644 --- a/app/xterm/vttests/88colors2.pl +++ b/app/xterm/vttests/88colors2.pl @@ -1,22 +1,56 @@ #!/usr/bin/perl -# Author: Steve Wall -# $XFree86: xc/programs/xterm/vttests/88colors2.pl,v 1.1 1999/09/25 14:38:51 dawes Exp $ -# Made from 256colors2.pl +# $XTermId: 88colors2.pl,v 1.6 2009/10/10 14:57:12 tom Exp $ +# Authors: Steve Wall +# Thomas E Dickey +# +# Adapted from 256colors2.pl # use the resources for colors 0-15 - usually more-or-less a # reproduction of the standard ANSI colors, but possibly more # pleasing shades +use strict; + +use Getopt::Std; + +our ($opt_h, $opt_q, $opt_r); +&getopts('hqr') || die("Usage: $0 [-q] [-r]"); +die("Usage: $0 [options]\n +Options: + -h display this message + -q quieter output by merging all palette initialization + -r display the reverse of the usual palette +") if ( $opt_h); + +our (@steps); +our ($red, $green, $blue); +our ($gray, $level, $color); + +sub map_cube($) { + my $value = $_[0]; + $value = (3 - $value) if defined($opt_r); + return $value; +} + +sub map_gray($) { + my $value = $_[0]; + $value = (7 - $value) if defined($opt_r); + return $value; +} + # colors 16-79 are a 4x4x4 color cube @steps=(0,139,205,255); +printf("\x1b]4") if ($opt_q); for ($red = 0; $red < 4; $red++) { for ($green = 0; $green < 4; $green++) { for ($blue = 0; $blue < 4; $blue++) { - printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", - 16 + ($red * 16) + ($green * 4) + $blue, + printf("\x1b]4") unless ($opt_q); + printf(";%d;rgb:%2.2x/%2.2x/%2.2x", + 16 + (map_cube($red) * 16) + (map_cube($green) * 4) + map_cube($blue), int (@steps[$red]), int (@steps[$green]), int (@steps[$blue])); + printf("\x1b\\") unless ($opt_q); } } } @@ -24,11 +58,14 @@ for ($red = 0; $red < 4; $red++) { # colors 80-87 are a grayscale ramp, intentionally leaving out # black and white for ($gray = 0; $gray < 8; $gray++) { - $level = ($gray * 23.18181818) + 46.36363636; + $level = (map_gray($gray) * 23.18181818) + 46.36363636; if( $gray > 0 ) { $level += 23.18181818; } - printf("\x1b]4;%d;rgb:%2.2x/%2.2x/%2.2x\x1b\\", + printf("\x1b]4") unless ($opt_q); + printf(";%d;rgb:%2.2x/%2.2x/%2.2x", 80 + $gray, int($level), int($level), int($level)); + printf("\x1b\\") unless ($opt_q); } +printf("\x1b\\") if ($opt_q); # display the colors -- cgit v1.2.3