Sponsored Content
Top Forums UNIX for Dummies Questions & Answers set background/foreground color in .profile Post 80891 by PxT on Friday 12th of August 2005 04:59:18 PM
Old 08-12-2005
Check the list of ANSI escape codes here: http://www.bluesock.org/~willg/dev/ansi.html

You just need to "echo" the appropriate codes to the screen. Note that any other command/program which uses ANSI color codes will reset your choices, so you may not get the desired affect by setting these in your profile.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

problems with ctrl-z, to switch foreground, background

my shell is /sbin/sh. i added stty susp '^Z' with the intention of being able to switch between foreground and background. but the result was strange. i had 2 servers. one is sun the os is 8 and the other is hpux v11. both of them had the same shell. but on hpux, it works perfectly fine while... (9 Replies)
Discussion started by: yls177
9 Replies

2. Shell Programming and Scripting

how to get background job to foreground

hi, i am just wondering that wen we give the following code we make a process run in background...can the viceversa be performed?i.e can this be made foreground again # sleep 75& 21751 # (4 Replies)
Discussion started by: sandilya
4 Replies

3. Shell Programming and Scripting

Background and Foreground of a process within a script

I'm not sure if it is even possible but I figured if it was someone here would know how to do it... I am running a script which starts a bunch of processes in the background but there is one process I would like to bring back to the foreground when complete. Unfortunately the process that I... (2 Replies)
Discussion started by: ctruhn
2 Replies

4. Shell Programming and Scripting

how to set background color in Unix terminal

Hi All, how do I set in .profile file Unix terminal background color = BLUE ? Please advice me. :confused: (2 Replies)
Discussion started by: raghur77
2 Replies

5. UNIX for Advanced & Expert Users

what is the diff b/w background and foreground process

What are all the difference between a Background and Foreground processes ?! A Background process does not have access to STDIN and OUT.. What else ? Is there any detailed description available somewhere ? (5 Replies)
Discussion started by: onequestion
5 Replies

6. Shell Programming and Scripting

Send Foreground job to background redirecting output

I have many CPU intensive processes running and sometimes I run them in the foreground so that I can see what the output is. I want to send that foreground process to the background, but also have it direct the output to a logfile. I know to send something to the bg I do Ctrl-z on the FG... (6 Replies)
Discussion started by: jhullbuzz
6 Replies

7. Shell Programming and Scripting

How can put a background process to the foreground

Hi, guys: I am working on my own shell using c. When I put a process into the background, how can I put it back to the foreground using tcsetpgrp? Thanks (3 Replies)
Discussion started by: tomlee
3 Replies

8. Shell Programming and Scripting

Move shell script from foreground to background

Hi, Need an urgent help. I have a program executing in foreground. I need to execute it in background and also to remove terminal dependency. Thanks In advance. 116@434 (7 Replies)
Discussion started by: 116@434
7 Replies

9. UNIX for Dummies Questions & Answers

How to change the background color in the init 3 mode(not line color)

Hello, I am using RHEL 6.1 on VMware I am searching for a way to change background color (not line by line color wich one can using tput command) basically changing the color of the whole screen to white instead of the default black and changing font color to black and alos would like to... (2 Replies)
Discussion started by: Dexobox
2 Replies

10. Shell Programming and Scripting

[Solved] Background and foreground colors for xterm

Hi all, I used the code given by cfajohnson on this forum to generate background colors for xterm. Thanks cfajohnson... (sorry wasnt allowed to past the complete url) n=200 ## adjust to taste: higher value, lighter background n1=$(( 256 - $n )) bg=$( printf "#%x%x%x\n" $(( $RANDOM % $n1 +... (2 Replies)
Discussion started by: carv_13
2 Replies
NCURSES_INIT_PAIR(3)							 1						      NCURSES_INIT_PAIR(3)

ncurses_init_pair - Define a color pair

SYNOPSIS
int ncurses_init_pair (int $pair, int $fg, int $bg) DESCRIPTION
Defines or redefines the given color pair to have the given foreground and background colors. If the color pair was previously initial- ized, the screen is refreshed and all occurrences of it are changed to reflect the new definition. Color capabilities must be initialized using ncurses_start_color(3) before calling this function. The first color pair (color pair 0) is assumed to be white on black by default, but can be changed using ncurses_assume_default_colors(3). PARAMETERS
o $pair - The number of the color pair to define. o $fg - The foreground color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color(3) if the terminal has color changing capabilities. o $bg - The background color for the color pair. May be one of the pre-defined colors or one defined by ncurses_init_color(3) if the terminal has color changing capabilities. RETURN VALUES
Returns -1 if the function was successful, and 0 if ncurses or color support were not initialized. NOTES
Note that color changing capabilities are not required for defining color pairs of pre-existing colors, but only for changing definitions (red, green, and blue components) of colors themselves per ncurses_init_color(3). EXAMPLES
Example #1 Writing a string with a specified color to the screen <?php ncurses_init(); // If the terminal supports colors, initialize and set active color if (ncurses_has_colors()) { ncurses_start_color(); ncurses_init_pair(1, NCURSES_COLOR_YELLOW, NCURSES_COLOR_BLUE); ncurses_color_set(1); } // Write a string at specified location ncurses_mvaddstr(10, 10, "Hello world! Yellow on blue text!"); // Flush output to screen ncurses_refresh(); ncurses_end(); ?> SEE ALSO
ncurses_pair_content(3), ncurses_start_color(3). PHP Documentation Group NCURSES_INIT_PAIR(3)
All times are GMT -4. The time now is 09:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy