Skip to content

Commit bafc199

Browse files
Adding resources, to-do, and shortening arguments and commands for easier typing
1 parent 4841cc4 commit bafc199

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

colortest.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
''' Resources
33
44
* https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
5+
* Good resource on how to manipulate terminal commands with Python
56
* https://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal
7+
* Contains links to powerful libraries that do similar things as this, as well as ways
8+
to do the same thing in bash
9+
* https://github.com/Markus00000/colorschemer/blob/master/colorschemer.py
10+
* Contains good explanation on how contrast gets calculated.
11+
* https://jonasjacek.github.io/colors/
12+
* contains JSON of xterm color/name/hex/rgb/hsl
13+
14+
TO DO:
15+
16+
* Figure out a way to check the contrast between foreground and background and only
17+
display the combos with high contrast.
618
'''
719

820

@@ -85,33 +97,36 @@ def allForegroundAndAllBackground():
8597
parser = argparse.ArgumentParser()
8698
subparsers = parser.add_subparsers(title='commands', dest='command')
8799

88-
dullForegroundColorsParser = subparsers.add_parser('dullForegroundColors', help='display the 8 dull foreground colors')
89-
brightForegroundColorsParser = subparsers.add_parser('brightForegroundColors', help='display the 8 bright foreground colors')
90-
dullBackgroundColorsParser = subparsers.add_parser('dullBackgroundColors', help='display the 8 dull background colors')
91-
backgroundBrightColorsParser = subparsers.add_parser('brightBackgroundColors', help='display the 8 bright background colors')
92-
allForegroundColorsParser = subparsers.add_parser('allForegroundColors', help='display 256 foreground colors')
93-
allBackgroundColorsParser = subparsers.add_parser('allBackgroundColors', help='display 256 background colors')
94-
allForegroundAllBackgroundParser = subparsers.add_parser('allForegroundAllBackground', help='display all 256 foreground and background colors separately')
95-
testForegroundOnBackgroundParser = subparsers.add_parser('testFgAndBg', help='Enter a foreground code and a background code and test it out')
100+
dullForegroundColorsParser = subparsers.add_parser('dullFg', help='display the 8 dull foreground colors')
101+
brightForegroundColorsParser = subparsers.add_parser('brightFg', help='display the 8 bright foreground colors')
102+
dullBackgroundColorsParser = subparsers.add_parser('dullBg', help='display the 8 dull background colors')
103+
backgroundBrightColorsParser = subparsers.add_parser('brightBg', help='display the 8 bright background colors')
104+
allForegroundColorsParser = subparsers.add_parser('allFg', help='display 256 foreground colors')
105+
allBackgroundColorsParser = subparsers.add_parser('allBg', help='display 256 background colors')
106+
allForegroundAllBackgroundParser = subparsers.add_parser('allFgBg', help='display all 256 foreground and background colors separately')
107+
allForegroundAllBackgroundParser = subparsers.add_parser('getFreaky', help='Display every combination of foreground and background color')
108+
testForegroundOnBackgroundParser = subparsers.add_parser('test', help='Enter a foreground code and a background code and test it out')
96109
testForegroundOnBackgroundParser.add_argument('FOREGROUND', type=int, help='foreground, must be between 0 and 256')
97110
testForegroundOnBackgroundParser.add_argument('BACKGROUND', type=int, help='background, must be between 0 and 256')
98111
args = parser.parse_args()
99112

100-
if args.command == 'dullForegroundColors':
113+
if args.command == 'dullFg':
101114
dullForegroundColors()
102-
elif args.command == 'brightForegroundColors':
115+
elif args.command == 'brightFg':
103116
brightForegroundColors()
104-
elif args.command == 'dullBackgroundColors':
117+
elif args.command == 'dullBg':
105118
dullBackgroundColors()
106-
elif args.command == 'brightBackgroundColors':
119+
elif args.command == 'brightBg':
107120
brightBackgroundColors()
108-
elif args.command == 'allForegroundColors':
121+
elif args.command == 'allFg':
109122
allForegroundColors()
110-
elif args.command == 'allBackgroundColors':
123+
elif args.command == 'allBg':
111124
allBackgroundColors()
112-
elif args.command == 'allForegroundAllBackground':
125+
elif args.command == 'allFgBg':
113126
allForegroundAndAllBackground()
114-
elif args.command == 'testFgAndBg':
127+
elif args.command == 'getFreaky':
128+
allForegroundAllBackground()
129+
elif args.command == 'test':
115130
testForegroundOnBackground(args.FOREGROUND, args.BACKGROUND)
116131
else:
117132
parser.print_help()

0 commit comments

Comments
 (0)