what are all the colors for os.system("color ??")

  • Last Update :
  • Techknowledgy :

Color attributes are specified by TWO hex digits -- the first corresponds to the background; the second the foreground. Each digit can be any of the following values:

0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

Suggestion : 2

Color attributes are specified by TWO anycodings_python hex digits -- the first corresponds to anycodings_python the background; the second the anycodings_python foreground. Each digit can be any of the anycodings_python following values:,I was wondering what other ones there were? anycodings_python Thanks!,Is there a package/command in R for restricted range correlations?,Source: anycodings_python http://dosprompt.info/commands/color.asp

example..

    os.system("colora 0a")

Color attributes are specified by TWO anycodings_python hex digits -- the first corresponds to anycodings_python the background; the second the anycodings_python foreground. Each digit can be any of the anycodings_python following values:

0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

Suggestion : 3

Hi, is there an internal module / method to change the colour of the text in the pythonwin?,I know that this is slightly unnecessary but I can't stand the sight of the above code. I don't know if your colour codes are right (I didn't test them), but this is just a much cleaner way of writing your little program. Just putting the simplicity of Python to good use, that's all., Reach out to all the awesome people in our software development community by starting your own topic. We equally welcome both specific questions as well as open-ended discussions. , We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.

If you have the Windows OS, here is an example ...

# change color in the python.exe console display(Windows)
# color is a two digit hexadecimal number
# the first digit is the background
# the second digit is the foreground(text)
# 0 = black 1 = blue 2 = green…

If you have the Windows OS, here is an example ...

# change color in the python.exe console display(Windows)
# color is a two digit hexadecimal number
# the first digit is the background
# the second digit is the foreground(text)
# 0 = black 1 = blue 2 = green...to E = yellow F = white

import os

os.system("color F2") # green(2) text on white(F) background

thanks, I used that and a bit of knowledge to make this:

import os, time
colours = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f')
def color(i):
   i = i.lower()
if i == 'black':
   return 0
if i == 'blue':
   return 1
if i == 'green':
   return 2
if i == 'aqua':
   return 3
if i == 'red':
   return 4
if i == 'purple':
   return 5
if i == 'yellow':
   return 6
if i == 'white':
   return 7
if i == 'grey':
   return 8
if i == 'light blue':
   return 9
if i == 'light green':
   return 'a'
if i == 'light aqua':
   return 'b'
if i == 'light red':
   return 'c'
if i == 'light purple':
   return 'd'
if i == 'light yellow':
   return 'e'
if i == 'bright white':
   return 'f'
text_colour = raw_input(""
      "
      What colour do you want the text ?
         Black
      Blue Green Aqua Red Purple Yellow White Grey Light Blue Light Green Light Aqua Light Red Light Purple Light Yellow Bright White ""
      ")

      bgc = raw_input(""
         "
         What colour do you want the text ?
            Black
         Blue Green Aqua Red Purple Yellow White Grey Light Blue Light Green Light Aqua Light Red Light Purple Light Yellow Bright White ""
         ")
         a = color(bgc) b = color(text_colour) c = 'color ' + str(a) + str(b) os.system(c) print ''
         print c time.sleep(3)

I know that this is slightly unnecessary but I can't stand the sight of the above code. I don't know if your colour codes are right (I didn't test them), but this is just a much cleaner way of writing your little program. Just putting the simplicity of Python to good use, that's all.

# this works, but I just don 't know if the colour codes are correct...
import os, time

colourcodes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'a', 'b', 'c', 'd', 'e', 'f']
colournames = ['black', 'blue', 'green', 'aqua', 'red', 'purple', 'yellow', 'white', 'grey', 'light blue', 'light green', 'light aqua', 'light red', 'light purple', 'light yellow', 'bright white']

def color(i):
   i = i.lower()
return colourcodes[colournames.index(i)]

print '\n'.join([c.title() for c in colournames])

txc = raw_input('\nWhat colour do you want the text?  ')
bgc = raw_input('\nWhat colour do you want the background?  ')
a = color(bgc)
b = color(txc)
c = 'color %s%s' % (a, b)

os.system(c)
print '\n' + c
time.sleep(3)