|
2 | 2 | ''' Resources |
3 | 3 |
|
4 | 4 | * https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html |
| 5 | + * Good resource on how to manipulate terminal commands with Python |
5 | 6 | * 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. |
6 | 18 | ''' |
7 | 19 |
|
8 | 20 |
|
@@ -85,33 +97,36 @@ def allForegroundAndAllBackground(): |
85 | 97 | parser = argparse.ArgumentParser() |
86 | 98 | subparsers = parser.add_subparsers(title='commands', dest='command') |
87 | 99 |
|
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') |
96 | 109 | testForegroundOnBackgroundParser.add_argument('FOREGROUND', type=int, help='foreground, must be between 0 and 256') |
97 | 110 | testForegroundOnBackgroundParser.add_argument('BACKGROUND', type=int, help='background, must be between 0 and 256') |
98 | 111 | args = parser.parse_args() |
99 | 112 |
|
100 | | -if args.command == 'dullForegroundColors': |
| 113 | +if args.command == 'dullFg': |
101 | 114 | dullForegroundColors() |
102 | | -elif args.command == 'brightForegroundColors': |
| 115 | +elif args.command == 'brightFg': |
103 | 116 | brightForegroundColors() |
104 | | -elif args.command == 'dullBackgroundColors': |
| 117 | +elif args.command == 'dullBg': |
105 | 118 | dullBackgroundColors() |
106 | | -elif args.command == 'brightBackgroundColors': |
| 119 | +elif args.command == 'brightBg': |
107 | 120 | brightBackgroundColors() |
108 | | -elif args.command == 'allForegroundColors': |
| 121 | +elif args.command == 'allFg': |
109 | 122 | allForegroundColors() |
110 | | -elif args.command == 'allBackgroundColors': |
| 123 | +elif args.command == 'allBg': |
111 | 124 | allBackgroundColors() |
112 | | -elif args.command == 'allForegroundAllBackground': |
| 125 | +elif args.command == 'allFgBg': |
113 | 126 | allForegroundAndAllBackground() |
114 | | -elif args.command == 'testFgAndBg': |
| 127 | +elif args.command == 'getFreaky': |
| 128 | + allForegroundAllBackground() |
| 129 | +elif args.command == 'test': |
115 | 130 | testForegroundOnBackground(args.FOREGROUND, args.BACKGROUND) |
116 | 131 | else: |
117 | 132 | parser.print_help() |
0 commit comments