Sponsored Content
Full Discussion: Print in color
Top Forums UNIX for Dummies Questions & Answers Print in color Post 302086567 by Corona688 on Friday 25th of August 2006 12:42:10 AM
Old 08-25-2006
If you mean console, try this ANSI color code in your shell:
Code:
# printf 'This word is \x1b[%i;3%imRED!\n\x1b[0m' 1 1

The first 1 is intensity; 0 is dark, 1 is bright. The second 1 is color; 1 is red, 2 is green, 4 is blue, 3 is yellow(red plus green), etc. The '\x1b[%i;3%im' sets color, with the %i's replaced by the 1's. The '\x1b[0m' resets the color back to defaults.
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

color print using perl

Hi i want to print the text in different color using perl script. i am able to print on console(terminal). but if i try to print the same into a file, i am not able to do color.pl #!/bin/usr/perl use Term::ANSIColor; print "This text is normal.\n"; use Term::ANSIColor qw(:constants);... (3 Replies)
Discussion started by: roopa
3 Replies

2. AIX

How to print color text in AIX?

Hi I'd like to print color text and I've tried this: echo "\033but it didn't woked. When I changed 0 --> 1/4/5, the text "HI" --> bold/underline/blink, but when I changed 31 or 33 to other values, the color didn't change. What's the problem. Need to install something ??? (8 Replies)
Discussion started by: bobochacha29
8 Replies
desktop_color_depth(3alleg4)					  Allegro manual				      desktop_color_depth(3alleg4)

NAME
desktop_color_depth - Finds out the desktop color depth. Allegro game programming library. SYNOPSIS
#include <allegro.h> int desktop_color_depth(); DESCRIPTION
Finds out the currently selected desktop color depth. You can use this information to make your program use the same color depth as the desktop, which will likely make it run faster because the graphic driver won't be doing unnecessary color conversions behind your back. Under some OSes, switching to a full screen graphics mode may automatically change the desktop color depth. You have, therefore, to call this function before setting any graphics mode in order to retrieve the real desktop color depth. Example: allegro_init(); ... if ((depth = desktop_color_depth()) != 0) { set_color_depth(depth); } RETURN VALUE
Returns the color depth or zero on platforms where this information is not available or does not apply. SEE ALSO
get_desktop_resolution(3alleg4), set_color_depth(3alleg4), set_gfx_mode(3alleg4) Allegro version 4.4.2 desktop_color_depth(3alleg4)
All times are GMT -4. The time now is 09:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy