Thread: change command promt color ?

  1. #1
    Registered User
    Join Date
    Apr 2010
    Location
    kingston jamaica
    Posts
    28

    change command promt color ?

    Does any body know the function that changes the color of the command prompt. I know there is one but i dont remember it and i am not finding i ton google.

  2. #2
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    It depends on the OS. There are no such functions in standard C.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Assuming your shell supports them, ANSI escape code - Wikipedia, the free encyclopedia


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Here's an examples of using ANSI with bash
    Code:
    #bash prompt
    RED="\[\033[1;31m\]"
    GREEN="\[\033[0;32m\]"
    ORANGE="\[\033[0;33m\]"
    BLUE="\[\033[0;34m\]"
    MAUVE="\[\033[1;35m\]"
    CYAN="\[\033[1;36m\]"
    GRAY="\[\033[0;37m\]"
    hmm="\[\033[0;30m\]"
    hmm2="\[\033[0;40m\]"
    WHITE="\[\033[00m\]"
    PS1="$MAUVE[$RED\u$CYAN\w$MAUVE] $WHITE"
    
    export PS1
    The last one sets the color back to white
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Towr of Hanoi move the disc
    By WatchTower in forum C Programming
    Replies: 9
    Last Post: 07-17-2009, 03:48 AM
  2. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  3. Need help with C program
    By ChrisH in forum C Programming
    Replies: 38
    Last Post: 11-13-2004, 01:11 AM
  4. Replies: 2
    Last Post: 09-04-2001, 02:12 PM
  5. is there a way to set a pixel or change font color?
    By Flikm in forum C++ Programming
    Replies: 9
    Last Post: 09-01-2001, 01:24 PM