Menu

How can one change the text color?

2005-03-24
2012-09-26
  • Nobody/Anonymous

    How can one change the displayed text color?

     
    • Nobody/Anonymous

      try google.com and look up the word "crayola"

       
    • Nobody/Anonymous

      If you're talking about the color that the code appears when you're writing it -

      Tools -> Compiler Options (or the 3rd one down) -> Syntax tab -> go from there.

       
    • Ian

      Ian - 2005-03-25

      If for the console, check out windows.h and conio.

       
    • Nobody/Anonymous

      I think I knew what you meen, loogk at

      http://www.daniweb.com/code/snippet83.html

      Payne Diaz

       
    • Nobody/Anonymous

      if you're using windows and don't mind using system commands:

      system("color &%");

      & and % are numbers/letters: 0 - 9, A - F, the first is the background, the second is text colour...

      just experiment and see what you get...

       
    • Edmund Tudor

      Edmund Tudor - 2005-03-30

      Here's an old post about that last method that gives the color value macros. The foreground and background each have a red, green, blue, and intensity bit, you OR those together to create the various color combinations.

      http://sourceforge.net/forum/message.php?msg_id=2424480

       
    • Kip

      Kip - 2005-04-02

      From ye ol' documentation:

      wAttributes

      Specifies the foreground and background color attributes. Any combination of the following values can be specified: FOREGROUND_BLUE, FOREGROUND_GREEN, FOREGROUND_RED, FOREGROUND_INTENSITY, BACKGROUND_BLUE, BACKGROUND_GREEN, BACKGROUND_RED, and BACKGROUND_INTENSITY. For example, the following combination of values produces white text on a black background:

      FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE

      Kip

       
    • Nobody/Anonymous

      simply tell it to change the color.

      You gave me no idea as to what you are talking about, so I can only return the same kind of answer.

      change the text color of what? the Dev C editor, a console program, windows gui program, the word "STOP" on the local stop sign down the street?

      Read the FAQ's before posting again please.

       
    • Pietro Gagliardi (andlabs)

      Or get Hongli Lai's CONIO for Dev-C++/MinGW (http://conio.sf.net/, or by the WebUpdate Module).

      • The Ampersand Laboratories Team <http://ww.andlabs.com/>
       
      • Marek Januszewski

        > Or get Hongli Lai's CONIO for Dev-C++/MinGW (http://conio.sf.net/, or by the WebUpdate Module).

        Hongli Lai is not a developer of this project
        http://sourceforge.net/projects/conio/

         
    • Nobody/Anonymous

      void Colors(int color)//7=normal,12=red
      {
      HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hCon,color);
      }

      include <windows.h> in headers.int color can be 0 to 255,make a loop and call Colors(loop) and cout <<"Hello World"<<endl; or something to view all the colors.Makes for a right purdy display.also cout the loop counter to see what number goes along with what color.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.