Color ???

How can i make a color like a square ? like a example:
----------
|Wellcome|
----------

but this square insade to be in a some color :? is it possible im not asking about windows :)
I do not really know how can solve this exercise but..
you can use dos color command for changing colors you can change backaround screen and lines.
if u change second number u change color of lyircs (charchers)
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048382857&id=1043284392

Prints red text to the console...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h> 
#include <windows.h> 

int main ( void )
{
  HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
  WORD wOldColorAttrs;
  CONSOLE_SCREEN_BUFFER_INFO csbiInfo; 
  
  /*
   * First save the current color information
   */
  GetConsoleScreenBufferInfo(h, &csbiInfo);
  wOldColorAttrs = csbiInfo.wAttributes; 
  
  /*
   * Set the new color information
   */
  SetConsoleTextAttribute ( h, FOREGROUND_RED | FOREGROUND_INTENSITY );
  
  printf ( "This is a test\n" );

  /*
   * Restore the original colors
   */
  SetConsoleTextAttribute ( h, wOldColorAttrs);
  return 0;
}
Last edited on
But I Know how to change color,but don't know how to make this thing the square and insade a example red and background green and lyrics to be a blue :?
I'm asking like this :

http://www.codeguru.com/cpp/w-d/console/article.php/c3959

but i can't do it :(
The author provided their source.

1
2
3
4
5
6
// Red on White
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
                  BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
                  BACKGROUND_RED | BACKGROUND_GREEN |
                  BACKGROUND_BLUE |
                  FOREGROUND_RED);

If you want red text on a green background

1
2
3
4
// Red on Green
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
                  BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
                  BACKGROUND_GREEN | FOREGROUND_RED);


insade a example red and background green and lyrics to be a blue

I don't know what you mean with this. Could you elaborate?

I'm guessing you want some text to be red on a green background followed by some blue text on the same green background? Correct me if I'm wrong.

To do that:

1
2
3
4
5
6
7
8
9
10
11
12
13
// Red on Green
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
                  BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
                  BACKGROUND_GREEN | FOREGROUND_RED);

printf("Example ");

// Blue on Green
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),
                  BACKGROUND_INTENSITY | FOREGROUND_INTENSITY |
                  BACKGROUND_GREEN | FOREGROUND_BLUE);

printf("Lyrics");
That's It man thanks very much :) works that i wanted to do :)
Topic archived. No new replies allowed.