1

According to msdn, ConsoleColor has 16 colours available.

Does this mean that each colour is represented using 4 bits?

Why have they limited it to only 16 colours?

Simple colours like orange aren't even available.

7
  • 2
    It is the standard CGA color palette. Orange has never been an option. I don't know what makes one color "simpler" than another, though. Commented May 22, 2014 at 7:35
  • The console has been around since the days of DOS bootup, so it is very likely that it is still 4 bits as this is when the core fundamentals of the console were created Commented May 22, 2014 at 7:36
  • Related: C++ Win32 Console Color, Use Custom Console Colors, and C++ Windows Console Color Palette Commented May 22, 2014 at 7:39
  • The enum type for ConsoleColor is implicitly typed as System.Int32, meaning that each value held within the enumeration consumes 32 bits of information. These do not directly relate to their color value. Historically, DOS (which System.Console emulates) only supported 16 colors (CGA), so the limited palette in ConsoleColor respects this historically. Commented May 22, 2014 at 8:42
  • I'd consider orange to be "simpler" than something like "magenta" or "darkGreen" for example. Maybe simpler isn't such a good word, replace simpler with "more common" Commented May 22, 2014 at 8:57

1 Answer 1

0

To answer your question:

Does this mean that each colour is represented using 4 bits?

which at least two people seem to have just ignored that you asked, that type is an enumeration and enumerations default to using Int32 as their underlying type so each value is represented using 32 bits.

Sign up to request clarification or add additional context in comments.

3 Comments

How does this answer the question? Why does that mean there is no orange color in the enumeration? Are you saying it would be impossible to add an additional member?
@CodyGray, if you take a look you will see that there are two question marks (?) in the OP, i.e. there are two questions. The first of those two questions is "Does this mean that each colour is represented using 4 bits" and that is the question that I have answered. I didn't bother answering the second because you already had, although instead of doing what you are supposed to and posting an answer, you did the wrong thing and posted a comment. Take a good look at yourself.
Hmm, I guess. I interpreted that question somewhat differently. I thought he was asking about the implementation of colors under the hood of the Console window, not how the enumeration works. Also, you are only supposed to post answers if they actually answer the question (mine was not a complete answer) and if the question is not a duplicate (which this one was).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.