[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: console fg & bg colours



On Fri, 17 Nov 1995, Bruce Perens wrote:

> If my memory is correct, Costa Rasmussen <cdr@sme.siemens.com>
> got us permission to distribute setterm. I don't know if he is
> packaging it, or waiting for someone else to package it.


I reckon that setterm is a bit of a horrible kludge, anyway.  Setting
colours is do-able within termcap and terminfo.

I've spent a few hours hacking away at these, and came up with the
following entries. I'm not great at termcap or terminfo, and these could
probably be done a lot better by somebody who knows what they're doing.
However, they work for me... I've now got white text on a blue 
background.  I'll tweak it some more over the next few days to give me 
different colours for bold, italic, etc.


See terminfo(5) for information about what it all means. see also a
reference on ANSI terminal escape codes...if I had of had one handy it
wouldn't have taken me anywhere near as long, I had to do the escape codes
from memory by trial and error. 


termcap:  (note, change the #li50 if you're not running in 50 line mode)

---cut here---
# hacked colour console by Craig Sanders (cas@muffin.pronet.com)
console-c|con80x50-c|linux-c|linux console-c:\
        :am:eo:mi:ms:ut:xn:xo:\
        :Co#8:co#80:it#8:li#50:pa#64:\
        :AB=\E[0;37;44m:AF=\E[0;37;44m:\
        :Sb=\E[0;37;44m:Sf=\E[0;37;44m:\
        :S2=\E[11m:S3=\E[10m:\
        :md=\E[1;37;44m:\
        :mr=\E[7;37;44m:\
        :mb=\E[5;37;44m:\
        :me=\E[0;37;44m:\
        :op=\E[37;44m:\
        :ZH=\E[0;36;44m:\
        :ZR=\E[0;37;44m:\
        :so=\E[7;37;44m:\
        :se=\E[0;37;44m:\
        :us=\E[4;37;44m:\
        :ue=\E[24;37;44m:\
        :u8=\E[?6c:\
        :u9=\E[c:\
        :tc=console:

# this is the original console entry.  it is included (tc=) by console-c above.
console|linux|linux console:\
        :do=^J:co#80:li#25:cl=\E[H\E[J:sf=\ED:sb=\EM:\
        :le=^H:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\
        :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[27m:us=\E[4m:ue=\E[m:\
        :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:is=\E[1;25r\E[25;1H:\
        :ll=\E[1;25r\E[25;1H:al=\E[L:dc=\E[P:dl=\E[M:\
        :it#8:ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:kb=^H:ti=\E[r\E[H:\
        :ho=\E[H:kP=\E[5~:kN=\E[6~:kH=\E[4~:kh=\E[1~:kD=\E[3~:kI=\E[2~:\
        :k1=\E[[A:k2=\E[[B:k3=\E[[C:k4=\E[[D:k5=\E[[E:k6=\E[17~:\
        :k7=\E[18~:k8=\E[19~:k9=\E[20~:k0=\E[21~:K1=\E[1~:K2=\E[5~:\
        :K4=\E[4~:K5=\E[6~:\
        :pt:sr=\EM:vt#3:xn:km:bl=^G:vi=\E[?25l:ve=\E[?25h:vs=\E[?25h:\
        :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:\
        :r1=\Ec:r2=\Ec:r3=\Ec:

---cut here---


terminfo:   (note, compile this with tic - make a backup copy of 
/usr/lib/terminfo/l/linux in case it doesn't work for you)

---cut here---
#	Reconstructed via infocmp from file: /etc/terminfo/l/linux
# hacked colour console by Craig Sanders (cas@muffin.pronet.com)
# this one still needs a bit of work
linux|linux console, 
	am, bce, eo, mir, msgr, xenl, xon, 
	colors#8, cols#80, it#8, lines#25, pairs#64, 
	acsc=`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\054\021+^P0\333, 
	bel=^G, blink=\E[5m, bold=\E[1;44m, civis=\E[?25l, 
	clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, 
	cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, 
	cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, 
	dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, 
	home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, 
	ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, 
	kb2=\E[G, kbs=^H, kcub1=\E[D, kcud1=\E[B, 
	kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, 
	kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, 
	kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, 
	kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, 
	kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, 
	kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, 
	khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, 
	kspd=^Z, nel=^M^J, op=\E[0;37;44m, rc=\E8, 
	rev=\E[7m, ri=\EM, rmacs=\E[10m, rmir=\E[4l, 
	rmpch=\E[10m, rmso=\E[0;37;44m, rmul=\E[0;44m, 
	rs1=\E0;44m, rs2=\E0;44m, rs3=\E0;44m, sc=\E7, 
	setab=\E[0;37;44m, setaf=\E[0;37;44m, 
	setb=\E[0;37;44m, setf=\E[0;37;44m, sgr0=\E[0;44m, 
	smacs=\E[11m, smir=\E[4h, smpch=\E[11m, smso=\E[7m, 
	smul=\E[4m, tbc=\E[3g, u8=\E[?6c, u9=\E[c, 
---cut here---



Craig

--
  cas@muffin.pronet.com                                cas@muffin.apana.org.au
   *       Unix Consulting:  Installation, Configuration, & Support.        *
   * --- Also, contact me if you need your Dos/Win/OS2 LAN connected to --- *
   * --- the Internet.                                                  --- *


Reply to: