1- #!/c/ Users/david/OneDrive/Documents/localServer /python_colors/bin/python3
1+ #!/Users/accomazzod/Projects/web /python_colors/bin/python3
22''' Resources
33
44 * https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
1313
1414 TO DO:
1515
16- * Figure out a way to check the contrast between foreground and background and only
17- display the combos with high contrast.
16+ * Figure out a way to check the contrast between foreground and background and only
17+ display the combos with high contrast.
1818'''
1919
2020
@@ -37,7 +37,7 @@ def brightForegroundColors():
3737# 256 Color range
3838def allForegroundColors ():
3939 print ("All 256 Color Foregrounds" )
40- for i in range (0 , 257 ):
40+ for i in range (0 , 256 ):
4141 num = str (i )
4242 color = f'\033 [38;5;{ num } m { num } \033 [0m \\ 033[38;5;{ num } m'
4343 sys .stdout .write (color .ljust (4 ))
@@ -59,17 +59,17 @@ def brightBackgroundColors():
5959# Background 256 Colors
6060def allBackgroundColors ():
6161 print ("All 256 Color Backgrounds" )
62- for i in range (0 , 257 ):
62+ for i in range (0 , 256 ):
6363 num = str (i )
6464 color = f'\033 [48;5;{ num } m { num } \033 [0m \\ 033[48;5;{ num } m'
6565 sys .stdout .write (color .ljust (4 ))
6666 if i % 5 == 0 and i != 0 :
6767 print ('' )
6868
69- # Getting Crazy with it
69+ # Getting Crazy with it
7070def allForegroundAllBackground ():
71- for i in range (0 , 257 ):
72- for j in range (0 , 257 ):
71+ for i in range (0 , 256 ):
72+ for j in range (0 , 256 ):
7373 foreground = str (j )
7474 background = str (i )
7575 color = f'\033 [38;5;{ foreground } m\033 [48;5;{ background } m { foreground } on { background } \033 [0m '
@@ -79,14 +79,14 @@ def allForegroundAllBackground():
7979
8080# Test out a foreground on a background
8181def testForegroundOnBackground (foreground , background ):
82- if foreground and background in range (0 , 257 ):
82+ if foreground and background in range (0 , 256 ):
8383 print (f'Testing { foreground } on { background } ' )
8484 print (f'\n \\ 033[38;5;{ foreground } m\\ 033[48;5;{ background } m TEXT HERE \\ 033[0m\n ' )
8585 print (f'\033 [38;5;{ foreground } m\033 [48;5;{ background } m{ foreground } on { background } test\033 [0m' )
8686 print (f'\033 [38;5;{ foreground } m\033 [48;5;{ background } mThe quick brown fox jumps over the lazy dog. \033 [0m' )
8787 print (f'\033 [38;5;{ foreground } m\033 [48;5;{ background } mABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789\033 [0m' )
8888 else :
89- print ('Both foreground and background number must be between 0 and 256 ' )
89+ print ('Both foreground and background number must be between 0 and 255 ' )
9090
9191# Print out all 256 foreground and background
9292def allForegroundAndAllBackground ():
0 commit comments