|
|
Subject:
Looking for 8-bit RGB values for each of the 16 VGA text mode colors
Category: Computers > Graphics Asked by: bigjosh-ga List Price: $25.00 |
Posted:
17 Dec 2002 11:52 PST
Expires: 16 Jan 2003 11:52 PST Question ID: 126097 |
I need to know the equivalent RGB values for all 16 foreground colors available in VGA text mode. Here are the 16 text mode colors... 0 black 8 dark gray 1 blue 9 bright blue 2 green 10 bright green 3 cyan 11 bright cyan 4 red 12 pink 5 magenta 13 bright magenta 6 brown 14 yellow 7 white 15 bright white What are the accocated 8-bit RGB values for each? (Please don't guess based on the names of the colors- I need to know the actual values that the VGA card uses) (Please don't tell me the RGBI values - I need to know the actual 3 values for the Red, Green, and Blue) thanks, josh |
|
Subject:
Re: Looking for 8-bit RGB values for each of the 16 VGA text mode colors
Answered By: seizer-ga on 17 Dec 2002 13:03 PST Rated: |
Hi there bigjosh! What a great question - it made me drag up my old VGA programming skills again. I wrote a small program to read these values directly from the video card. In VGA text mode, the RGB triplet is only represented by the first six bits of the byte, so the range returned is beteen 0 and 63. If you're looking for values to use in an 8 bit RGB system, the best you can do is to quadruple these values (not ideal, because bright white is given as 252, 252, 252, when in fact it should be 255, 255, 255). If you're interested, the way to retrieve these values when programming, is as follows: * Set port 0x3c7 to the value of the colour you want to read * Read port 0x3c9 three times, one for each colour component Here are the RGB triplets for VGA text mode: --- Colour: 0 VGA 6 bit colour: R:0|G:0|B:0 Approximate 8 bit colour: R:0|G:0|B:0 --- Colour: 1 VGA 6 bit colour: R:0|G:0|B:42 Approximate 8 bit colour: R:0|G:0|B:168 --- Colour: 2 VGA 6 bit colour: R:0|G:42|B:0 Approximate 8 bit colour: R:0|G:168|B:0 --- Colour: 3 VGA 6 bit colour: R:0|G:42|B:42 Approximate 8 bit colour: R:0|G:168|B:168 --- Colour: 4 VGA 6 bit colour: R:42|G:0|B:0 Approximate 8 bit colour: R:168|G:0|B:0 --- Colour: 5 VGA 6 bit colour: R:42|G:0|B:42 Approximate 8 bit colour: R:168|G:0|B:168 --- Colour: 6 VGA 6 bit colour: R:42|G:42|B:0 Approximate 8 bit colour: R:168|G:168|B:0 --- Colour: 7 VGA 6 bit colour: R:52|G:52|B:52 Approximate 8 bit colour: R:208|G:208|B:208 --- Colour: 8 VGA 6 bit colour: R:42|G:42|B:42 Approximate 8 bit colour: R:168|G:168|B:168 --- Colour: 9 VGA 6 bit colour: R:0|G:0|B:63 Approximate 8 bit colour: R:0|G:0|B:252 --- Colour: 10 VGA 6 bit colour: R:0|G:63|B:0 Approximate 8 bit colour: R:0|G:252|B:0 --- Colour: 11 VGA 6 bit colour: R:0|G:63|B:63 Approximate 8 bit colour: R:0|G:252|B:252 --- Colour: 12 VGA 6 bit colour: R:63|G:0|B:0 Approximate 8 bit colour: R:252|G:0|B:0 --- Colour: 13 VGA 6 bit colour: R:63|G:0|B:63 Approximate 8 bit colour: R:252|G:0|B:252 --- Colour: 14 VGA 6 bit colour: R:63|G:63|B:0 Approximate 8 bit colour: R:252|G:252|B:0 --- Colour: 15 VGA 6 bit colour: R:63|G:63|B:63 Approximate 8 bit colour: R:252|G:252|B:252 --- I hope this answers your question, and these values prove useful to you. Please don't hesitate to request clarification before rating this answer, if you would like me to provide any more detail. Thanks, --seizer-ga No searching required, as I had previous knowledge of VGA programming. | |
| |
| |
|
bigjosh-ga
rated this answer:
Could not download your exe from the link, but I manually read the values using DEBUG and got 42,42,0 just like you did on a VGA machine under real DOS. My only guess is that this pallette is used for text emulation under graphics modes and not for actual text modes. I guess I'll just try to find a match for brown using a color detector and plugging a screen back and forth. Oh well, let me know if you think of anyother way. Thanks. |
|
Subject:
Re: Looking for 8-bit RGB values for each of the 16 VGA text mode colors
From: bavi_h-ga on 11 Feb 2003 05:15 PST |
I acquired this data from programming in BASIC but I'm not sure how it actually relates to the true colors used by the VGA card. When programming in some languages (BASIC), each of the colors could be assigned a number from the master palette of 64 colors. It turns out that this master palette number is really an encoding for the bits of red, green, and blue, as follows: R0 G0 B0 R1 G1 B1 In this method, red, greeen, and blue are described using 2 bits (values from 0 to 3). To convert to a 8 bit system (values 0 to 255) I multiplied by 85. color no 2-bit RGB 8-bit RGB ================= == ========= =============== 0 black........ 0 (0, 0, 0) ( 0, 0, 0) 1 blue......... 1 (0, 0, 2) ( 0, 0, 170) 2 green........ 2 (0, 2, 0) ( 0, 170, 0) 3 cyan......... 3 (0, 2, 2) ( 0, 170, 170) 4 red.......... 4 (2, 0, 0) (170, 0, 0) 5 magenta...... 5 (2, 0, 2) (170, 0, 170) 6 brown........ 20 (2, 1, 0) (170, 85, 0) 7 white........ 7 (2, 2, 2) (170, 170, 170) 8 gray......... 56 (1, 1, 1) ( 85, 85, 85) 9 light blue... 57 (1, 1, 3) ( 85, 85, 255) 10 light green.. 58 (1, 3, 1) ( 85, 255, 64) 11 light cyan... 59 (1, 3, 3) ( 85, 255, 255) 12 light red.... 60 (3, 1, 1) (255, 85, 85) 13 light magenta 61 (3, 1, 3) (255, 85, 255) 14 yellow....... 62 (3, 3, 1) (255, 255, 85) 15 bright white. 63 (3, 3, 3) (255, 255, 255) If instead I multiply by 84, I get values identical to those in seizer's answer, except I get (168, 84, 0) for brown. |
Subject:
Re: Looking for 8-bit RGB values for each of the 16 VGA text mode colors
From: bavi_h-ga on 11 Feb 2003 05:35 PST |
Oops! light green should be (85, 255, 85) And looking closer, when I multiply by 84 I get similar values, but my answers do differ from seizer's... In any case, I think the method of restircting RGB to 4 levels is the key here... |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |