| |||||||
| Coding / Scripting / Programming Discussions on all manner of coding and scripting. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) | |
| This is way ahead of where my C++ 1 class is, but its been driving me nuts trying to figure out how to change colors in the dos box. What our teacher showed us was system("color 3") which depending on what number, or combination to 2 numbers changes the text and background colors. Unfortunately this changes the color of everything. What I want is a rediculously simple code that would allow me to change the text color of individual characters or lines of text. For example if I could do something like cout << (RED) << "\nHello World!"; where it would change the color for just that particular line of code. Thx | ||
| | | |
| | #2 (permalink) | |
| My first thought would be to use ANSI escape sequences: http://www.evergreen.edu/biophysics/...m/ansi_esc.htm So your code might look like: cout << "\033[31;43mHello world\n"; // red on yellowThere are other ways too, using conio.h: http://forums.dreamincode.net/index....0&#entry125754 EDIT: I seem to recall the "\033[" was the escape sequence on Unix; I think in DOS it's ASCII character 27. Last edited by FunkyFresh; 13-October-05 at 05:24 PM.. | ||
| | | |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SunBeam Chameleon Color Changing QUAD LED Laser Kit $2.99 | coweater58 | Deals and Steals | 3 | 07-September-06 09:29 PM |
| Changing the color of a CCF Light | Nexto | Case Modding | 11 | 31-March-05 06:48 PM |
| Icon text Background color Problem | Fatsobob | Windows OS Problems | 17 | 01-February-05 09:31 PM |
| Changing the color of my keyboard. | StatiK | Painting | 3 | 26-May-04 12:40 PM |
| Changing Drive color | PowersurgeX | Painting | 3 | 05-February-03 05:57 PM |