colors (yes again)

This is a discussion on colors (yes again) within the C++ Programming forums, part of the General Programming Boards category; i change the colors in a console game i am amking, but how do i return the colors to the ...

  1. #1
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608

    colors (yes again)

    i change the colors in a console game i am amking, but how do i return the colors to the normal dos mode color. i know its not white cause its to bright! i use this code with the conio.o header file
    Code:
    textcolor(WHITE);
    clrscr();
    Email: Klinerr1@nc.rr.com || AIM: MisterSako || MSN: sakotheinsane@hotmail.com

    -the shroom has spoken

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Um...i'm assuming you have a typo and you mean conio.h. And it is white.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    145

    LIGHTGRAY

    No, default color for DOS is LIGHTGRAY.
    Code:
    textcolor(LIGHTGRAY);
    clrscr();
    Or I got some wierd version of DOS
    "Um...well..."
    -Kyoto Oshiro

  4. #4
    Registered User
    Join Date
    Jun 2002
    Posts
    39
    When I tried this code it didn't work. Here's my code.
    Code:
    #include <iostream>
    #include <conio.h>
    using namespace std;
    
    int main()
    {
    textcolor (RED);
    clrscr();
    cout << "Testing";
    
    return 0;
    }
    Compiler: Dev-C++ 4.9.8.0

    -Bert

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    145
    Code:
    #include <iostream.h>
    #include <conio.h>
    
    int main()
    {
    textcolor(RED);
    clrscr();
    cout<< "Testing\n";
    cout<<endl;
    return(0);
    }
    Bert, I am not sure whether you put a space between textcolor and the first bracket, may just be a typo, but you need to type it like above, then it will work fine.
    "Um...well..."
    -Kyoto Oshiro

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Bert, I am not sure whether you put a space between textcolor
    >and the first bracket, may just be a typo, but you need to type it like above, then it will work fine.
    Huh? Whether you put a space between the function identifier and the argument list is irrelevant, it will work both ways assuming conio.h supports textcolor. Unless, of course, they've changed the free-form nature of C++ while I wasn't looking.

    >#include <iostream.h>
    For the record, the .h extension to C++ header files has been deprecated. You really shouldn't be using it if you want your code to work indefinitely.

    Bert, the functions contained in conio.h are very much implementation-specific. Make sure that your compiler supports the functionality that you want. To my knowledge, only Borland supports textcolor, though Dev C++ may as well.

    -Prelude
    My best code is written with the delete key.

  7. #7
    Registered User
    Join Date
    Feb 2002
    Posts
    145
    Oh...well...remind me not to answer any more questions Sorry Bert, maybe it is your compiler then. I just thought that maybe the space mattered...right...read my signature when in doubt.
    "Um...well..."
    -Kyoto Oshiro

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I just thought that maybe the space mattered
    If it did then I would be in big trouble. My style looks like this:

    textcolor ( RED );



    -Prelude
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Jun 2002
    Posts
    39
    -I use Bloodshed Dev-C++ 4.9.3.0 so it may be my complier.

    -That space wasn't a typo, I put it there on purpose. And you can have as many spaces you want in your C++ source code.
    Code:
    #include <iostream>
    
    int main()
    {
    c             o
        u       t
    <    
    <            "Testing
       ";
    
    re
       turn 0;
    }
    Will still print "Testing".
    Compiler: Dev-C++ 4.9.8.0

    -Bert

  10. #10
    Seven years? civix's Avatar
    Join Date
    Jul 2002
    Posts
    605
    hey, bert...just a well known fact here...HTML is not a programming language...it's a scripting language..

  11. #11
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    if ur using dev c++ like yours truly make sure u open ur project using the .dev fiel not .cpp file so ur editing the project file nto just the .cpp file. and go to project on the top menu bar thing go to project options and you gotta add conio.o from the c:\dev-c++\libraries\conio.o or its osmethgin like that but the directires cant have spaces (that the file is in) so its best to install dev c++ at its defualt directory.
    Email: Klinerr1@nc.rr.com || AIM: MisterSako || MSN: sakotheinsane@hotmail.com

    -the shroom has spoken

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why I only get 8 colors out of ncurses?
    By Nazgulled in forum C Programming
    Replies: 3
    Last Post: 05-08-2007, 06:06 PM
  2. Relation between material colors and light colors.
    By indigo0086 in forum Game Programming
    Replies: 3
    Last Post: 04-18-2007, 03:20 PM
  3. colors in forefox and colors in IE
    By MisterSako in forum Tech Board
    Replies: 3
    Last Post: 05-15-2006, 01:59 PM
  4. colors?
    By planet_abhi in forum Game Programming
    Replies: 1
    Last Post: 09-10-2003, 05:37 PM
  5. Text Colors
    By GaPe in forum C Programming
    Replies: 1
    Last Post: 07-11-2002, 06:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21