Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Sep 1995 20:21:14 +0100 (MET)
From:      Christoph Kukulies <kuku@gilberto.physik.RWTH-Aachen.DE>
To:        bemar@servicom.es (Antonio Navarro)
Cc:        questions@freebsd.org
Subject:   Re: Using color in C
Message-ID:  <199509251921.UAA06649@gilberto.physik.RWTH-Aachen.DE>
In-Reply-To: <9509251840.AA12127@servicom.es> from "Antonio Navarro" at Sep 25, 95 06:42:29 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Hello !
> 
> I am trying to use colors under C. How can I show colors on the 
> screen (something similar to the COLOR statement in Basic) ?. I 
> have read the source code of the vidcontrol program (because 
> you can obtain 16 colors when you execute the vidcontrol 
> utility with the 'show' keyword), but I do not understand the 
> sequences to obtain color.
> 
> Thanks in advance.

You can alsway use ANSI escape sequences a la:

#!/bin/sh
in0="\033[0m"
in1="\033[1m"
sw0="\033[30m"
rt0="\033[31m"
gn0="\033[32m"
gb0="\033[33m"
bl0="\033[34m"
mg0="\033[35m"
cn0="\033[36m"
ws0="\033[37m"
sw1="\033[40m"
rt1="\033[41m"
gn1="\033[42m"
gb1="\033[43m"
bl1="\033[44m"
mg1="\033[45m"
cn1="\033[46m"
ws1="\033[47m"
printf "\033[H\033[J\033[41m$gn0\Free\033[42m$bl0\BSD$in0\n"

> 
> Antonio Navarro
> L'Eliana - Valencia (Spain)
> 
> 
> 

--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509251921.UAA06649>