how to make your own color in c++?

I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!

I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!

Comments

  • : I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!
    :
    : I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!
    :
    Good Day!!Iam john erick of the philippines and I can help you on your problem. But first, I want you to answer my question to you.

    which directive are you using the "#include" with the " #include" or "#include"?

    If you are using the "#include", I can help you. And to contact me, please send me an Email through But if dont, sorry to tell you that I am not very aware of that directive.
  • : I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!
    :
    : I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!
    :

    hELLO!! Again, I'm john. I want to answer your question regarding on graphics in C.

    To make your text color, read this pls.:

    sample program:
    ------------------------
    #include |
    #include |
    #include |
    main() |
    { |
    clrscr(); |
    printf("33[2J"); |
    printf("
    Hello!!"); |
    getch(); |
    } |
    ------------------------
    /*The example above uses 3 escape characters. The first 0 sets the text mode to 40 colomns and 25 rows . The second 33 sets the foreground text color to yellow. The last [2J clears the screen.*/

    The list below shows the escape characters that are supported:


    /* escape characters used for changig color */

    foreground color attributes

    30 black
    31 red
    32 green
    33 yellow
    34 blue
    35 magenta
    36 cyan
    37 white


    background color attributes


    40 black
    41 red
    42 green
    43 yellow
    44 blue
    45 magenta
    46 cyan
    47 white


    /* escape characters used to change text attributes */

    0 switches off all other attributes
    1 bold text
    4 underlined text
    5 blinking text
    7 invers display
    8 characters not visible on screen

    /* escape characters used to change video mode */
    video mode settings

    0 40 cols, 25 rows, monochrom text
    1 40 cols, 25 rows, color text
    2 80 cols, 25 rows, monochrom text
    3 80 cols, 25 rows, color text


    4 320*200 pxl, screen resolution, multi-color
    5 320*200 pxl, monochrom graphics
    6 640*200 pxl, monchrom graphics
    7 characters at the end of a line will be taken to next line


    13 320*200 pxl screen resolution, color graphics
    14 640*200 pxl 16 color graphics
    15 640*350 pxl monochrom graphics (2 color)
    16 640*350 pxl 16 color graphics
    17 640*480 pxl monochrom graphics (2 color)
    18 640*480 pxl 16 bit color
    19 320*200 pxl 256 color graphics

    Did you get it? If not, pleasepost your questions again in the message board. Thanks. ☺ ☺ ☺

  • : : I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!
    : :
    : : I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!
    : :
    :
    : hELLO!! Again, I'm john. I want to answer your question regarding on graphics in C.
    :
    : To make your text color, read this pls.:
    :
    : sample program:
    : ------------------------
    : #include |
    : #include |
    : #include |
    : main() |
    : { |
    : clrscr(); |
    : printf("33[2J"); |
    : printf("
    Hello!!"); |
    : getch(); |
    : } |
    : ------------------------
    : /*The example above uses 3 escape characters. The first 0 sets the text mode to 40 colomns and 25 rows . The second 33 sets the foreground text color to yellow. The last [2J clears the screen.*/
    :
    : The list below shows the escape characters that are supported:
    :
    :
    : /* escape characters used for changig color */
    :
    : foreground color attributes
    :
    : 30 black
    : 31 red
    : 32 green
    : 33 yellow
    : 34 blue
    : 35 magenta
    : 36 cyan
    : 37 white
    :
    :
    : background color attributes
    :
    :
    : 40 black
    : 41 red
    : 42 green
    : 43 yellow
    : 44 blue
    : 45 magenta
    : 46 cyan
    : 47 white
    :
    :
    : /* escape characters used to change text attributes */
    :
    : 0 switches off all other attributes
    : 1 bold text
    : 4 underlined text
    : 5 blinking text
    : 7 invers display
    : 8 characters not visible on screen
    :
    : /* escape characters used to change video mode */
    : video mode settings
    :
    : 0 40 cols, 25 rows, monochrom text
    : 1 40 cols, 25 rows, color text
    : 2 80 cols, 25 rows, monochrom text
    : 3 80 cols, 25 rows, color text
    :
    :
    : 4 320*200 pxl, screen resolution, multi-color
    : 5 320*200 pxl, monochrom graphics
    : 6 640*200 pxl, monchrom graphics
    : 7 characters at the end of a line will be taken to next line
    :
    :
    : 13 320*200 pxl screen resolution, color graphics
    : 14 640*200 pxl 16 color graphics
    : 15 640*350 pxl monochrom graphics (2 color)
    : 16 640*350 pxl 16 color graphics
    : 17 640*480 pxl monochrom graphics (2 color)
    : 18 640*480 pxl 16 bit color
    : 19 320*200 pxl 256 color graphics
    :
    : Did you get it? If not, pleasepost your questions again in the message board. Thanks. ☺ ☺ ☺
    :
    :
    [blue]
    is an old borland header, and is borland
    specific--ie; nonstandard.

    Are you using DOS? If so, you can either use
    or inline asm. is more standard then
    (Although I believe it is depreciated.)

    Of course, if this isnt an issue, might be
    a better option.

    (Why did they use escape chars to set video modes??)
    That just doesnt make sense, imo.

    ~mt2002[/blue]
  • :
    : is more standard then
    : (Although I believe it is depreciated.)
    :

    1. dos.h and graphics.h are two completly different animals -- both may be required in any given program.
    2. neither dos.h nor graphics.h were ever ansi standard files. One cannot be [b]more standard[/b] than another -- it is either standard or it is not, there is no middle ground.
    3. that entire compiler, and MS-DOS itself, is depreciated (very very very very obsolete). But its ok for fun and giggles, just don't plan on doing anything serious with them.
  • : 2. neither dos.h nor graphics.h were ever ansi standard files. One cannot be [b]more standard[/b] than another -- it is either standard or it is not, there is no middle ground.

    You are of course right, but what I think he ment is that dos.h is to prefer sence it might be supported by another (obsolete) compiler.

    But the same philosophy could also be used on modern compilers: it is better to use console functions from windows.h than from conio.h sence windows.h will be supported by all Windows compilers.


  • : But the same philosophy could also be used on modern compilers: it is better to use console functions from windows.h than from conio.h sence windows.h will be supported by all Windows compilers.
    :
    :

    Only current windows compilers. I've heard rumors that windows.h and the entire win32 api may become depreciated soon.
  • :
    : : But the same philosophy could also be used on modern compilers: it is better to use console functions from windows.h than from conio.h sence windows.h will be supported by all Windows compilers.
    : :
    : :
    :
    : Only current windows compilers. I've heard rumors that windows.h and the entire win32 api may become depreciated soon.
    :
    [blue]These are just rumours.
    On Vista one will be able to use even assembler.
    What Microsoft said is that they will not be extending the Win32 API itself no more. More fun classes are included into .NET.
    [/blue]
  • : : I would appreciate anyone who is well versed with turbo c++ v 3.0 to reply to this post. If you believe you can answer this post otherwise then you are most welcome...!
    : :
    : : I would like a c or c++ program in which i can make my own colour (in the graphics mode)? And I don't have that much of knowledge of assembly either. So i guess this will be difficult. But do try giving me the required logic/theory behind constructing this program. I guess it would be of great help!!!
    : :
    :
    : hELLO!! Again, I'm john. I want to answer your question regarding on graphics in C.
    :
    : To make your text color, read this pls.:
    :
    : sample program:
    : ------------------------
    : #include |
    : #include |
    : #include |
    : main() |
    : { |
    : clrscr(); |
    : printf("33[2J"); |
    : printf("
    Hello!!"); |
    : getch(); |
    : } |
    : ------------------------
    : /*The example above uses 3 escape characters. The first 0 sets the text mode to 40 colomns and 25 rows . The second 33 sets the foreground text color to yellow. The last [2J clears the screen.*/
    :
    : The list below shows the escape characters that are supported:
    :
    :
    : /* escape characters used for changig color */
    :
    : foreground color attributes
    :
    : 30 black
    : 31 red
    : 32 green
    : 33 yellow
    : 34 blue
    : 35 magenta
    : 36 cyan
    : 37 white
    :
    :
    : background color attributes
    :
    :
    : 40 black
    : 41 red
    : 42 green
    : 43 yellow
    : 44 blue
    : 45 magenta
    : 46 cyan
    : 47 white
    :
    :
    : /* escape characters used to change text attributes */
    :
    : 0 switches off all other attributes
    : 1 bold text
    : 4 underlined text
    : 5 blinking text
    : 7 invers display
    : 8 characters not visible on screen
    :
    : /* escape characters used to change video mode */
    : video mode settings
    :
    : 0 40 cols, 25 rows, monochrom text
    : 1 40 cols, 25 rows, color text
    : 2 80 cols, 25 rows, monochrom text
    : 3 80 cols, 25 rows, color text
    :
    :
    : 4 320*200 pxl, screen resolution, multi-color
    : 5 320*200 pxl, monochrom graphics
    : 6 640*200 pxl, monchrom graphics
    : 7 characters at the end of a line will be taken to next line
    :
    :
    : 13 320*200 pxl screen resolution, color graphics
    : 14 640*200 pxl 16 color graphics
    : 15 640*350 pxl monochrom graphics (2 color)
    : 16 640*350 pxl 16 color graphics
    : 17 640*480 pxl monochrom graphics (2 color)
    : 18 640*480 pxl 16 bit color
    : 19 320*200 pxl 256 color graphics
    :
    : Did you get it? If not, pleasepost your questions again in the message board. Thanks. ☺ ☺ ☺
    :
    :
    [blue]
    Dear John,
    I tried that code but my output is not what you claim it is!!

    The output goes something like an arrow followed by the "[2J"
    and in the next line "Hello!!"
    This might be an exaggerated output below:

    [code]
    <-[2J
    Hello!!
    [/code]
    Can this be the problem of the version I use - Turbo C++ Version 3.0?

    And I was thinking creating my own color...? I was expecting you would give me a code that initializes the graphics screen and everything (the initgraph() ). I am aware of the setcolor() function. But I can only get predefined colors!!! Yellow has the number 14; so:-
    [code]
    setcolor(14);
    [/code]
    ...should make any thing coming after that instruction yellow.

    What do I do if I need (say) gold or silver color? In windows you have the RGB specification. Is there something similiar?
    [/blue]
  • hey guys! don't you know "i love you virus"? the creator of that virus was john erick! ahahaha.. is in on it.. so there no worry about it, use a code that can run your program. everybody has a different logical thinking. ok?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories