|
|
Log in / Subscribe / Register

Colors, ^@ support

Colors, ^@ support

Posted Jun 5, 2004 6:01 UTC (Sat) by utoddl (guest, #1232)
Parent article: The Grumpy Editor's guide to terminal emulators

I used to hope gnome-terminal would start passing ^@ to the application (as one of my apps needs it, and I use it regularly). Maybe it does now, but I just use xterm. Anyway, if anyone's compiling a list of things to check for in terminal emulators, please add that to the list.

As for colors, I finally gave up trying to find a combo I wanted to stick with. Instead, I found a whole class of background colors I like. So I wrote an xterm starter in Perl that picks a suitable background color for me at random from those that meet my criteria. It gets called when I click on one of those new-fangled icon thingies at the bottom of my screen. It's a work in progress that sort of stopped progressing when it got good enough. Yeah, it's a resource hog, but they're my resources. (Oh, and the indentation/brace placement style you've never seen before is as God intended. :) Here goes. Enjoy:

#!/usr/bin/perl
my @colors = ( 'wheat' );
if ( open COLORS, "/usr/X11R6/bin/showrgb|" )
    {
      my ($minc, $mind, $maxd ) = ( 127, 7, 97 );
      while (<COLORS>)
        {
          chomp;
          my ($r,$g,$b,$cname) = split /\s+/,$_,4;
          next unless $r > $minc && $g > $minc && $b > $minc &&
                      abs( $r - $g) > $mind && abs( $r - $g) < $maxd &&
                      abs( $r - $b) > $mind && abs( $r - $b) < $maxd &&
                      abs( $g - $b) > $mind && abs( $g - $b) < $maxd;
          push @colors, $cname;
        }
      close COLORS;
    }
my $bg = $colors[ int( rand @colors ) ];
exec '/usr/X11R6/bin/xterm', '-bg', $bg, '-fg', 'black', '-fn', '9x15';


to post comments

Colors, ^@ support

Posted Jun 5, 2004 12:43 UTC (Sat) by tzafrir (subscriber, #11501) [Link]

black on wheat (this is not a typo) is good enough for me. In some extreme cases (such as when I use pinfo) I use the "reverse color" option.

$ grep XTerm ~/.Xresources
XTerm*foreground: black
XTerm*background: wheat
XTerm*font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-8
UXTerm*foreground: black
UXTerm*background: wheat
UXTerm*font: -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds