Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Orange terminal text

Tags:

python

linux

bash

Why do you never see orange terminal text?

For example in python:

class text_color:
        black = '\033[30m'
        red = '\033[31m'
        green = '\033[32m'
        yellow = '\033[33m'
        blue = '\033[34m'
        magenta = '\033[35m'
        cyan = '\033[36m'
        white = '\033[37m'

# START MAIN
print text_color.yellow + "YAY"

Why doesn't this below work? Why dont you ever see orange as an option?

orange = '\033[40m'

* SOLUTION *

I didn't really understand terminals at the start of this problem. If you are in my same shoes, please reference this site to answer your question:

http://misc.flogisoft.com/bash/tip_colors_and_formatting

like image 657
Atomiklan Avatar asked Jul 30 '15 16:07

Atomiklan


2 Answers

Escape codes come from the days where a computer couldn't display more than 8 different colours simultaneously - They had to pick what these 8 colours (8 foreground, 8 background for a total of "16 colours") were, and orange was not one of the choices when they selected them.

EDIT: Please note that these are colours defined in the ANSI standard - there are terminals out there that have colours other than ANSI, although ANSI is most widespread (and these days ubiquitous) - Also users may manipulate their terminals to display other colour schemes.

like image 173
SteJ Avatar answered Oct 06 '22 00:10

SteJ


Because you can't just make up a code and assign it a color name because you want it to exist?

Your terminal only has the colors it has available. (Many go to 88 or 256 at this point but those are extended codes.)

Also technically you don't know that 36 (for example) is actually cyan. You just know you are asking for the color in that slot (the terminal can have any color in that slot it wants).

like image 35
Etan Reisner Avatar answered Oct 05 '22 23:10

Etan Reisner