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.

Sayse
  • 42,633
  • 14
  • 77
  • 146
David Klempfner
  • 8,700
  • 20
  • 73
  • 153
  • 2
    It is the [standard CGA color palette](http://en.wikipedia.org/wiki/List_of_8-bit_computer_hardware_palettes#CGA). Orange has never been an option. I don't know what makes one color "simpler" than another, though. – Cody Gray - on strike May 22 '14 at 07: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 – Sayse May 22 '14 at 07:36
  • Related: [C++ Win32 Console Color](http://stackoverflow.com/q/17125440), [Use Custom Console Colors](http://stackoverflow.com/q/22196664), and [C++ Windows Console Color Palette](http://stackoverflow.com/q/21343186) – Cody Gray - on strike May 22 '14 at 07: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. – Matthew Layton May 22 '14 at 08: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" – David Klempfner May 22 '14 at 08:57
  • @series0ne, at least you noticed the first question, unlike some. – jmcilhinney May 22 '14 at 09:16
  • @Backwards_Dave, given that magenta is an elemental colour in the CMYK palette, I'd say that you may be the only person who would consider orange to be "simpler". Obviously the creators of the CGA palette, all those years ago, felt differently. – jmcilhinney May 22 '14 at 09:18

1 Answers1

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.

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46
  • 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? – Cody Gray - on strike May 22 '14 at 07:42
  • 1
    @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. – jmcilhinney May 22 '14 at 09:15
  • 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). – Cody Gray - on strike May 22 '14 at 09:18