37

I can't get the terminal color palette to work with curses.

import curses

def main(stdscr):
    curses.use_default_colors()
    for i in range(0,7):
        stdscr.addstr("Hello", curses.color_pair(i))
    stdscr.getch()

curses.wrapper(main)

This python script yields the following screen:

enter image description here

However, I do have more colors in my gnome-terminal palette. How can I access them within curses?

chtenb
  • 14,924
  • 14
  • 78
  • 116

8 Answers8

65

The following I figured out by experiment on my own pc (Ubuntu 14.04, python 3).

  • There are 256 colors (defined by the first 8 bits).
  • The other bits are used for additional attributes, such as highlighting.
  • Passing the number -1 as color falls back to the default background and foreground colors.
  • The color pair 0 (mod 256) is fixed on (-1, -1).
  • The colors 0 till 15 are the terminal palette colors.

Consider the following testing code. Add this to your .bashrc:

# Set proper $TERM if we are running gnome-terminal
if [ "$COLORTERM" == "gnome-terminal" ]
then
    TERM=xterm-256color
fi

Put this in a python file and run it.

import curses

def main(stdscr):
    curses.start_color()
    curses.use_default_colors()
    for i in range(0, curses.COLORS):
        curses.init_pair(i + 1, i, -1)
    try:
        for i in range(0, 255):
            stdscr.addstr(str(i), curses.color_pair(i))
    except curses.ERR:
        # End of screen reached
        pass
    stdscr.getch()

curses.wrapper(main)

Running it will yield the following output.

screenshot

As you see, the colors pairs 1-16 are the terminal color palette for foreground colors.

chtenb
  • 14,924
  • 14
  • 78
  • 116
  • 2
    Are you sure this was the code for that screenshot? In my system (Ubuntu 12.04), `curses.COLORS` is 8, not 256, and any attempt to init a pair using a color above that throws the exception `_curses.error: init_pair() returned ERR`. What `curses` module are you using, the default one from Python's stdlib? – MestreLion Jan 28 '15 at 06:31
  • 2
    Yes, I'm sure it is the correct screenshot. Running it again on my ubuntu 14.04 (using python3) yields the same output. And `curses.COLORS` is 256 for me. – chtenb Jan 28 '15 at 09:25
  • 1
    So is Gnome Terminal finally using `TERM=xterm-256color` by default? Great! Or did you manually add that to your `~/.profile` / `~/.bashrc`? Care to check those files for any `TERM`-related code? – MestreLion Jan 29 '15 at 11:48
  • Ah, yes, now that you mention it I remember to have done that. I will update the answer to include that. – chtenb Jan 29 '15 at 12:05
  • 1
    More than half of this answer is incorrect. Martijn's answer is okay (could be presented better, but in any case all of the information needed is in the ncurses manual pages). – Thomas Dickey Jan 07 '17 at 16:53
  • 2
    @ThomasDickey if you think the information on this stack can be improved, provide your own answer. Also, the information can't be incorrect as it's a description of an experiment along with observations from my machine at the time of posting this answer. – chtenb Jan 09 '17 at 13:13
  • 1
    If `xterm-256color` does not work, use [`ls /usr/share/terminfo/x`](https://stackoverflow.com/a/20212351/2192488) to list the available terminals. – Serge Stroobandt Jul 11 '17 at 11:46
  • chtenb Just in case you didn't know, @ThomasDickey is the maintainer of ncurses and has been for around 30 years. – Enfors Aug 02 '22 at 09:31
16

The terminal 'color palette' is set by the terminal application itself to map default curses colours to application-specific 'interpretations'. If you use red, the terminal can choose to display that as burgundy or cherry red, or if the user so desires, something completely different.

In other words, just use the curses colours (combined with or without the bright or blink modifiers) and things should Just Work.

I believe that the curses.use_default_colors() call merely makes transparency available; it is a direct call to the use_default_colors() ncurses API function. ncurses colors are otherwise palette based; you need to set your own color attributes per pair number with curses.init_pair() calls, then select a color pair with curses.color_pair() from the palette to display text with that specific pair; or build text attributes directly for a given addstr() call.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • 1
    So, how should I use these colors in terms of the code in the question? – chtenb Sep 08 '13 at 14:26
  • @Chiel92: I may have missed something; does `stdscr.can_change_color()` return `True`? – Martijn Pieters Sep 08 '13 at 14:36
  • @Chiel92: it usually only does in the Linux terminal, the ones accessible in most distros via `CTRL+ALT+<1...6>` (7 being your Desktop Environment). In such terminals you *can* assign an RGB value for each color. – MestreLion Jan 28 '15 at 06:09
11

I currently put these lines in front of my script.

curses.use_default_colors()
for i in range(0, curses.COLORS):
    curses.init_pair(i, i, -1);

I don't know if it is the best solution, but at least it yields some color pairs that are consistent with the terminal color palette.

chtenb
  • 14,924
  • 14
  • 78
  • 116
  • It's a nice solution, as it assigns the first 8 pairs to their "matching" foreground color, using default (possibly transparent) background. Just be aware that you you can have much more than 8 pairs: here `curses.COLOR_PAIRS` returns `64`. – MestreLion Jan 28 '15 at 06:12
  • great option for quick initialization.. just wondering if there is any way to relate the color number to a real color name ( say 'red' ) here.. or just have to do trial and error.. is there any default order in which these colors appear? – kollery Dec 05 '16 at 17:00
  • Afaik the best you can do is look at the colors using the script from http://stackoverflow.com/a/22166613/1546844 and try to find patterns that allow you to do what you want. It may differ per terminal what colors correspond to what numbers, I'm not sure. – chtenb Dec 05 '16 at 18:59
  • `OSX 10.13.2` -- I put your code at the top of the main() function for wrapper, and colors started working for me. Thanks. – 7stud Feb 01 '18 at 12:36
6

I don't have the rep-points to submit this as a comment to Chiel ten Brinke's excellent answer, so I'll offer here a more useful version of his color script:

import curses
def main(stdscr):
    curses.start_color()
    curses.use_default_colors()
    for i in range(0, curses.COLORS):
        curses.init_pair(i + 1, i, -1)
    stdscr.addstr(0, 0, '{0} colors available'.format(curses.COLORS))
    maxy, maxx = stdscr.getmaxyx()
    maxx = maxx - maxx % 5
    x = 0
    y = 1
    try:
        for i in range(0, curses.COLORS):
            stdscr.addstr(y, x, '{0:5}'.format(i), curses.color_pair(i))
            x = (x + 5) % maxx
            if x == 0:
                y += 1
    except curses.ERR:
        pass
    stdscr.getch()
curses.wrapper(main)
Hristo Eftimov
  • 13,845
  • 13
  • 50
  • 77
user1404316
  • 463
  • 6
  • 11
3

You can use the culour package by installing with:

pip install culour

And then you can use it to print with color to curses:

culour.addstr(window, "colored string")
speller
  • 1,641
  • 2
  • 20
  • 27
3

Late answer, but might help out other curses newbies.

curses.start_color (called by curses.wrapper) initializes 8 basic colors, so one would assume you can just use curses.color_pair(i) to display colors. However, curses does not only have colors, it also has color_pairs, and only the later can be used to display color, but start_color only initializes colors, and use_default_colors only initializes color number -1.

This means that after this point you do not have any color pairs set up, only colors. You have to set up the color pairs manually before you can draw. You can also change the definitions of the induvidual colors if you wish, but as others have demonstrated you usually already have quite a few set up.

TL;DR:

If you struggle with no colors displayed after calling wrapper or start_color and use_default_colors, you might be missing the fact that you have to set up color pairs with init_pair before drawing in color.

Uncle Dino
  • 812
  • 1
  • 7
  • 23
1

curses.use_default_colors() merely sets the default fg or bg colors to -1, from the man page "init_pair(x,COLOR_RED,-1) will initialize pair x as red on default background and init_pair(x,-1,COLOR_BLUE) will initialize pair x as default foreground on blue."

I always assumed that curses supported only the 8 named "curses.COLOR_..." and usually that's enough but I wanted some spice in my apps so a short time searching found me here. Most likely the majority of terms will support 256 color, and you can use @Hristo Eftimov's code above to just print what ever is supported. I decided to make an alternate color chooser which will show examples of x color number as foreground and background. Arrow keys left/right or keys a/d to change which attribute to alter, +/- to incr/decr the color number, q or esc to quit.


    #!/usr/bin/python
    
    from traceback import format_exc
    import sys, os, time, re, curses
    import locale
    locale.setlocale(locale.LC_ALL, '')
    os.environ.setdefault('ESCDELAY', '250')
    os.environ["NCURSES_NO_UTF8_ACS"] = "1"
    
    move_dirs = {curses.KEY_DOWN : (1, 0), curses.KEY_UP : (-1, 0), curses.KEY_RIGHT : (0, 1), curses.KEY_LEFT : (0, -1),
                 ord('s') : (1, 0), ord('w') : (-1, 0), ord('d') : (0, 1), ord('a') : (0, -1)}
    
    colors = {'white': curses.COLOR_WHITE, 'red': curses.COLOR_RED, 'green': curses.COLOR_GREEN,
              'yellow': curses.COLOR_YELLOW, 'blue': curses.COLOR_BLUE, 'magenta': curses.COLOR_MAGENTA,
              'cyan': curses.COLOR_CYAN, 'black': curses.COLOR_BLACK}
    
    class SuspendCurses():
        def __enter__(self):
            curses.endwin()
        def __exit__(self, exc_type, exc_val, tb):
            newscr = curses.initscr()
            newscr.refresh()
            curses.doupdate()
    
    def cp(i):
        return curses.color_pair(i)
    
    def set_pairs(fg, bg):
        curses.init_pair(1, fg, colors['black'])
        curses.init_pair(2, fg, colors['yellow'])
        curses.init_pair(3, fg, colors['white'])
        curses.init_pair(4, fg, colors['red'])
        curses.init_pair(5, colors['black'], bg)
        curses.init_pair(6, colors['yellow'], bg)
        curses.init_pair(7, colors['white'], bg)
        curses.init_pair(8, colors['red'], bg)
    
    def main_loop(stdscr):
        ret = 0
        EXIT = False
        try:
            curses.curs_set(1) #set curses options and variables
            curses.noecho()
            curses.cbreak()
            maxc = curses.COLORS
            maxy, maxx = stdscr.getmaxyx()
            if maxy < 10 or maxx < 65:
                with SuspendCurses():
                    print('Terminal window needs to be at least 10h by 65w')
                    print('Current h:{0}  and w:{1}'.format(maxy, maxx))
                ret = 1
                EXIT = True
            stdscr.refresh()
            h, w = 10, 65
            test_win = curses.newwin(h, w, 0, 0)
            stdscr.nodelay(1)
            test_win.leaveok(0)
            test_win.keypad(1)
            test_win.bkgd(' ', cp(0))
            test_win.box()
            cursor = [2, 0]
            test_win.move(2, 2+cursor[1]*20)
            fgcol, bgcol = 1, 1
            set_pairs(fgcol, bgcol)
            test_win.refresh()
            cursor_bounds = ((0,0),(0,1))
            teststr = '! @ # $ % ^ & *     _ + - = '
            k, newk = 1, 2
            while not EXIT:
                if k > -1:
                    test_win.clear()
                    if k in move_dirs.keys():  #move cursor left or right with wrapping
                        cursor[1] += move_dirs[k][1]
                        if cursor[1] > cursor_bounds[1][1]: cursor[1] = cursor_bounds[1][0]
                        if cursor[1] < cursor_bounds[1][0]: cursor[1] = cursor_bounds[1][1]
                    if k == 45:  #decr currently selected attr
                        if cursor[1] == 0:
                            fgcol -= 1
                            if fgcol < 0: fgcol = maxc-1
                        else:
                            bgcol -= 1
                            if bgcol < 0: bgcol = maxc-1
                        set_pairs(fgcol, bgcol)
                    if k == 43:  #incr currently selected attr
                        if cursor[1] == 0:
                            fgcol += 1
                            if fgcol > maxc-1: fgcol = 0
                        else:
                            bgcol += 1
                            if bgcol > maxc-1: bgcol = 0
                        set_pairs(fgcol, bgcol)
                    if k in (ord('q'), 27):
                        EXIT = True
                    test_win.addstr(1, 10, '{0} colors supported'.format(maxc), cp(0))
                    test_win.addstr(2, 2, 'FG: {0}  '.format(fgcol), cp(0))
                    test_win.addstr(2, 32, 'BG: {0}  '.format(bgcol), cp(0))
                    for i in range(1,5):
                        test_win.addstr(3+i, 2, teststr, cp(i))
                        test_win.addstr(3+i, 32,teststr, cp(i+4))
                    test_win.move(1, 2+cursor[1]*30)
                    test_win.box()
                    test_win.refresh()
                    curses.napms(10)
                newk = stdscr.getch()
                if newk != k:
                    k = newk
        except KeyboardInterrupt:
            pass
        except:
            ret = 1
            with SuspendCurses():
                print(format_exc())
        finally:
            return ret
    
    if __name__ == '__main__':
        try:
            _ret = curses.wrapper(main_loop)
        except Exception as e:
            print(e)
        finally:
            print('Exit status ' + str(_ret))
            sys.exit(_ret)

Screenshot:

screenshot

dejanualex
  • 3,872
  • 6
  • 22
  • 37
1

Here is an example that has a map of color names to curses RGB (0-1000):

enter image description here

# -*- coding: utf-8 -*-

import curses

COLOR_DEFAULT = -1

# Colors sourced from https://www.colorhexa.com/color-names
color_name_to_rgb = {
    "WHITE": (1000, 1000, 1000),
    "BLACK": (0, 0, 0),
    "RED": (1000, 0, 0),
    "GREEN": (0, 1000, 0),
    "BLUE": (0, 0, 1000),
    "AIR_FORCE_BLUE": (364, 541, 658),
    "ALICE_BLUE": (941, 972, 1000),
    "ALIZARIN_CRIMSON": (890, 149, 211),
    "ALMOND": (937, 870, 803),
    "AMARANTH": (898, 168, 313),
    "AMBER": (1000, 749, 0),
    "AMERICAN_ROSE": (1000, 11, 243),
    "AMETHYST": (600, 400, 800),
    "ANDROID_GREEN": (643, 776, 223),
    "ANTI_FLASH_WHITE": (949, 952, 956),
    "ANTIQUE_BRASS": (803, 584, 458),
    "ANTIQUE_FUCHSIA": (568, 360, 513),
    "ANTIQUE_WHITE": (980, 921, 843),
    "AO": (0, 501, 0),
    "APPLE_GREEN": (552, 713, 0),
    "APRICOT": (984, 807, 694),
    "AQUA": (0, 1000, 1000),
    "AQUAMARINE": (498, 1000, 831),
    "ARMY_GREEN": (294, 325, 125),
    "ARYLIDE_YELLOW": (913, 839, 419),
    "ASH_GREY": (698, 745, 709),
    "ASPARAGUS": (529, 662, 419),
    "ATOMIC_TANGERINE": (1000, 600, 400),
    "AUBURN": (647, 164, 164),
    "AUREOLIN": (992, 933, 0),
    "AUROMETALSAURUS": (431, 498, 501),
    "AWESOME": (1000, 125, 321),
    "AZURE": (0, 498, 1000),
    "AZURE_MIST_WEB": (941, 1000, 1000),
    "BABY_BLUE": (537, 811, 941),
    "BABY_BLUE_EYES": (631, 792, 945),
    "BABY_PINK": (956, 760, 760),
    "BALL_BLUE": (129, 670, 803),
    "BANANA_MANIA": (980, 905, 709),
    "BANANA_YELLOW": (1000, 882, 207),
    "BATTLESHIP_GREY": (517, 517, 509),
    "BAZAAR": (596, 466, 482),
    "BEAU_BLUE": (737, 831, 901),
    "BEAVER": (623, 505, 439),
    "BEIGE": (960, 960, 862),
    "BISQUE": (1000, 894, 768),
    "BISTRE": (239, 168, 121),
    "BITTERSWEET": (996, 435, 368),
    "BLACK": (0, 0, 0),
    "BLANCHED_ALMOND": (1000, 921, 803),
    "BLEU_DE_FRANCE": (192, 549, 905),
    "BLIZZARD_BLUE": (674, 898, 933),
    "BLOND": (980, 941, 745),
    "BLUE": (0, 0, 1000),
    "BLUE_BELL": (635, 635, 815),
    "BLUE_GRAY": (400, 600, 800),
    "BLUE_GREEN": (50, 596, 729),
    "BLUE_PURPLE": (541, 168, 886),
    "BLUE_VIOLET": (541, 168, 886),
    "BLUSH": (870, 364, 513),
    "BOLE": (474, 266, 231),
    "BONDI_BLUE": (0, 584, 713),
    "BONE": (890, 854, 788),
    "BOSTON_UNIVERSITY_RED": (800, 0, 0),
    "BOTTLE_GREEN": (0, 415, 305),
    "BOYSENBERRY": (529, 196, 376),
    "BRANDEIS_BLUE": (0, 439, 1000),
    "BRASS": (709, 650, 258),
    "BRICK_RED": (796, 254, 329),
    "BRIGHT_CERULEAN": (113, 674, 839),
    "BRIGHT_GREEN": (400, 1000, 0),
    "BRIGHT_LAVENDER": (749, 580, 894),
    "BRIGHT_MAROON": (764, 129, 282),
    "BRIGHT_PINK": (1000, 0, 498),
    "BRIGHT_TURQUOISE": (31, 909, 870),
    "BRIGHT_UBE": (819, 623, 909),
    "BRILLIANT_LAVENDER": (956, 733, 1000),
    "BRILLIANT_ROSE": (1000, 333, 639),
    "BRINK_PINK": (984, 376, 498),
    "BRITISH_RACING_GREEN": (0, 258, 145),
    "BRONZE": (803, 498, 196),
    "BROWN": (647, 164, 164),
    "BUBBLE_GUM": (1000, 756, 800),
    "BUBBLES": (905, 996, 1000),
    "BUFF": (941, 862, 509),
    "BULGARIAN_ROSE": (282, 23, 27),
    "BURGUNDY": (501, 0, 125),
    "BURLYWOOD": (870, 721, 529),
    "BURNT_ORANGE": (800, 333, 0),
    "BURNT_SIENNA": (913, 454, 317),
    "BURNT_UMBER": (541, 200, 141),
    "BYZANTINE": (741, 200, 643),
    "BYZANTIUM": (439, 160, 388),
    "CG_BLUE": (0, 478, 647),
    "CG_RED": (878, 235, 192),
    "CADET": (325, 407, 447),
    "CADET_BLUE": (372, 619, 627),
    "CADET_GREY": (568, 639, 690),
    "CADMIUM_GREEN": (0, 419, 235),
    "CADMIUM_ORANGE": (929, 529, 176),
    "CADMIUM_RED": (890, 0, 133),
    "CADMIUM_YELLOW": (1000, 964, 0),
    "CAFÉ_AU_LAIT": (650, 482, 356),
    "CAFÉ_NOIR": (294, 211, 129),
    "CAL_POLY_POMONA_GREEN": (117, 301, 168),
    "CAMBRIDGE_BLUE": (639, 756, 678),
    "CAMEL": (756, 603, 419),
    "CAMOUFLAGE_GREEN": (470, 525, 419),
    "CANARY": (1000, 1000, 600),
    "CANARY_YELLOW": (1000, 937, 0),
    "CANDY_APPLE_RED": (1000, 31, 0),
    "CANDY_PINK": (894, 443, 478),
    "CAPRI": (0, 749, 1000),
    "CAPUT_MORTUUM": (349, 152, 125),
    "CARDINAL": (768, 117, 227),
    "CARIBBEAN_GREEN": (0, 800, 600),
    "CARMINE": (1000, 0, 250),
    "CARMINE_PINK": (921, 298, 258),
    "CARMINE_RED": (1000, 0, 219),
    "CARNATION_PINK": (1000, 650, 788),
    "CARNELIAN": (701, 105, 105),
    "CAROLINA_BLUE": (600, 729, 866),
    "CARROT_ORANGE": (929, 568, 129),
    "CELADON": (674, 882, 686),
    "CELESTE": (698, 1000, 1000),
    "CELESTIAL_BLUE": (286, 592, 815),
    "CERISE": (870, 192, 388),
    "CERISE_PINK": (925, 231, 513),
    "CERULEAN": (0, 482, 654),
    "CERULEAN_BLUE": (164, 321, 745),
    "CHAMOISEE": (627, 470, 352),
    "CHAMPAGNE": (980, 839, 647),
    "CHARCOAL": (211, 270, 309),
    "CHARTREUSE": (498, 1000, 0),
    "CHERRY": (870, 192, 388),
    "CHERRY_BLOSSOM_PINK": (1000, 717, 772),
    "CHESTNUT": (803, 360, 360),
    "CHOCOLATE": (823, 411, 117),
    "CHROME_YELLOW": (1000, 654, 0),
    "CINEREOUS": (596, 505, 482),
    "CINNABAR": (890, 258, 203),
    "CINNAMON": (823, 411, 117),
    "CITRINE": (894, 815, 39),
    "CLASSIC_ROSE": (984, 800, 905),
    "COBALT": (0, 278, 670),
    "COCOA_BROWN": (823, 411, 117),
    "COFFEE": (435, 305, 215),
    "COLUMBIA_BLUE": (607, 866, 1000),
    "COOL_BLACK": (0, 180, 388),
    "COOL_GREY": (549, 572, 674),
    "COPPER": (721, 450, 200),
    "COPPER_ROSE": (600, 400, 400),
    "COQUELICOT": (1000, 219, 0),
    "CORAL": (1000, 498, 313),
    "CORAL_PINK": (972, 513, 474),
    "CORAL_RED": (1000, 250, 250),
    "CORDOVAN": (537, 247, 270),
    "CORN": (984, 925, 364),
    "CORNELL_RED": (701, 105, 105),
    "CORNFLOWER": (603, 807, 921),
    "CORNFLOWER_BLUE": (392, 584, 929),
    "CORNSILK": (1000, 972, 862),
    "COSMIC_LATTE": (1000, 972, 905),
    "COTTON_CANDY": (1000, 737, 850),
    "CREAM": (1000, 992, 815),
    "CRIMSON": (862, 78, 235),
    "CRIMSON_RED": (600, 0, 0),
    "CRIMSON_GLORY": (745, 0, 196),
    "CYAN": (0, 1000, 1000),
    "DAFFODIL": (1000, 1000, 192),
    "DANDELION": (941, 882, 188),
    "DARK_BLUE": (0, 0, 545),
    "DARK_BROWN": (396, 262, 129),
    "DARK_BYZANTIUM": (364, 223, 329),
    "DARK_CANDY_APPLE_RED": (643, 0, 0),
    "DARK_CERULEAN": (31, 270, 494),
    "DARK_CHESTNUT": (596, 411, 376),
    "DARK_CORAL": (803, 356, 270),
    "DARK_CYAN": (0, 545, 545),
    "DARK_ELECTRIC_BLUE": (325, 407, 470),
    "DARK_ORANGE": (721, 525, 43),
    "DARK_GRAY": (662, 662, 662),
    "DARK_GREEN": (3, 196, 125),
    "DARK_JUNGLE_GREEN": (101, 141, 129),
    "DARK_KHAKI": (741, 717, 419),
    "DARK_LAVA": (282, 235, 196),
    "DARK_LAVENDER": (450, 309, 588),
    "DARK_MAGENTA": (545, 0, 545),
    "DARK_MIDNIGHT_BLUE": (0, 200, 400),
    "DARK_OLIVE_GREEN": (333, 419, 184),
    "DARK_ORANGE": (1000, 549, 0),
    "DARK_ORCHID": (600, 196, 800),
    "DARK_PASTEL_BLUE": (466, 619, 796),
    "DARK_PASTEL_GREEN": (11, 752, 235),
    "DARK_PASTEL_PURPLE": (588, 435, 839),
    "DARK_PASTEL_RED": (760, 231, 133),
    "DARK_PINK": (905, 329, 501),
    "DARK_POWDER_BLUE": (0, 200, 600),
    "DARK_RASPBERRY": (529, 149, 341),
    "DARK_RED": (545, 0, 0),
    "DARK_SALMON": (913, 588, 478),
    "DARK_SCARLET": (337, 11, 98),
    "DARK_SEA_GREEN": (560, 737, 560),
    "DARK_SIENNA": (235, 78, 78),
    "DARK_SLATE_BLUE": (282, 239, 545),
    "DARK_SLATE_GRAY": (184, 309, 309),
    "DARK_SPRING_GREEN": (90, 447, 270),
    "DARK_TAN": (568, 505, 317),
    "DARK_TANGERINE": (1000, 658, 70),
    "DARK_TAUPE": (282, 235, 196),
    "DARK_TERRA_COTTA": (800, 305, 360),
    "DARK_TURQUOISE": (0, 807, 819),
    "DARK_VIOLET": (580, 0, 827),
    "DARTMOUTH_GREEN": (0, 411, 243),
    "DAVY_GREY": (333, 333, 333),
    "DEBIAN_RED": (843, 39, 325),
    "DEEP_CARMINE": (662, 125, 243),
    "DEEP_CARMINE_PINK": (937, 188, 219),
    "DEEP_CARROT_ORANGE": (913, 411, 172),
    "DEEP_CERISE": (854, 196, 529),
    "DEEP_CHAMPAGNE": (980, 839, 647),
    "DEEP_CHESTNUT": (725, 305, 282),
    "DEEP_COFFEE": (439, 258, 254),
    "DEEP_FUCHSIA": (756, 329, 756),
    "DEEP_JUNGLE_GREEN": (0, 294, 286),
    "DEEP_LILAC": (600, 333, 733),
    "DEEP_MAGENTA": (800, 0, 800),
    "DEEP_PEACH": (1000, 796, 643),
    "DEEP_PINK": (1000, 78, 576),
    "DEEP_SAFFRON": (1000, 600, 200),
    "DEEP_SKY_BLUE": (0, 749, 1000),
    "DENIM": (82, 376, 741),
    "DESERT": (756, 603, 419),
    "DESERT_SAND": (929, 788, 686),
    "DIM_GRAY": (411, 411, 411),
    "DODGER_BLUE": (117, 564, 1000),
    "DOGWOOD_ROSE": (843, 94, 407),
    "DOLLAR_BILL": (521, 733, 396),
    "DRAB": (588, 443, 90),
    "DUKE_BLUE": (0, 0, 611),
    "EARTH_YELLOW": (882, 662, 372),
    "ECRU": (760, 698, 501),
    "EGGPLANT": (380, 250, 317),
    "EGGSHELL": (941, 917, 839),
    "EGYPTIAN_BLUE": (62, 203, 650),
    "ELECTRIC_BLUE": (490, 976, 1000),
    "ELECTRIC_CRIMSON": (1000, 0, 247),
    "ELECTRIC_CYAN": (0, 1000, 1000),
    "ELECTRIC_GREEN": (0, 1000, 0),
    "ELECTRIC_INDIGO": (435, 0, 1000),
    "ELECTRIC_LAVENDER": (956, 733, 1000),
    "ELECTRIC_LIME": (800, 1000, 0),
    "ELECTRIC_PURPLE": (749, 0, 1000),
    "ELECTRIC_ULTRAMARINE": (247, 0, 1000),
    "ELECTRIC_VIOLET": (560, 0, 1000),
    "ELECTRIC_YELLOW": (1000, 1000, 0),
    "EMERALD": (313, 784, 470),
    "ETON_BLUE": (588, 784, 635),
    "FALLOW": (756, 603, 419),
    "FALU_RED": (501, 94, 94),
    "FAMOUS": (1000, 0, 1000),
    "FANDANGO": (709, 200, 537),
    "FASHION_FUCHSIA": (956, 0, 631),
    "FAWN": (898, 666, 439),
    "FELDGRAU": (301, 364, 325),
    "FERN": (443, 737, 470),
    "FERN_GREEN": (309, 474, 258),
    "FERRARI_RED": (1000, 156, 0),
    "FIELD_DRAB": (423, 329, 117),
    "FIRE_ENGINE_RED": (807, 125, 160),
    "FIREBRICK": (698, 133, 133),
    "FLAME": (886, 345, 133),
    "FLAMINGO_PINK": (988, 556, 674),
    "FLAVESCENT": (968, 913, 556),
    "FLAX": (933, 862, 509),
    "FLORAL_WHITE": (1000, 980, 941),
    "FLUORESCENT_ORANGE": (1000, 749, 0),
    "FLUORESCENT_PINK": (1000, 78, 576),
    "FLUORESCENT_YELLOW": (800, 1000, 0),
    "FOLLY": (1000, 0, 309),
    "FOREST_GREEN": (133, 545, 133),
    "FRENCH_BEIGE": (650, 482, 356),
    "FRENCH_BLUE": (0, 447, 733),
    "FRENCH_LILAC": (525, 376, 556),
    "FRENCH_ROSE": (964, 290, 541),
    "FUCHSIA": (1000, 0, 1000),
    "FUCHSIA_PINK": (1000, 466, 1000),
    "FULVOUS": (894, 517, 0),
    "FUZZY_WUZZY": (800, 400, 400),
    "GAINSBORO": (862, 862, 862),
    "GAMBOGE": (894, 607, 58),
    "GHOST_WHITE": (972, 972, 1000),
    "GINGER": (690, 396, 0),
    "GLAUCOUS": (376, 509, 713),
    "GLITTER": (901, 909, 980),
    "GOLD": (1000, 843, 0),
    "GOLDEN_BROWN": (600, 396, 82),
    "GOLDEN_POPPY": (988, 760, 0),
    "GOLDEN_YELLOW": (1000, 874, 0),
    "ORANGE": (854, 647, 125),
    "GRANNY_SMITH_APPLE": (658, 894, 627),
    "GRAY": (501, 501, 501),
    "GRAY_ASPARAGUS": (274, 349, 270),
    "GREEN": (0, 1000, 0),
    "GREEN_BLUE": (66, 392, 705),
    "GREEN_YELLOW": (678, 1000, 184),
    "GRULLO": (662, 603, 525),
    "GUPPIE_GREEN": (0, 1000, 498),
    "HALAYÀ_ÚBE": (400, 219, 329),
    "HAN_BLUE": (266, 423, 811),
    "HAN_PURPLE": (321, 94, 980),
    "HANSA_YELLOW": (913, 839, 419),
    "HARLEQUIN": (247, 1000, 0),
    "HARVARD_CRIMSON": (788, 0, 86),
    "HARVEST_GOLD": (854, 568, 0),
    "HEART_GOLD": (501, 501, 0),
    "HELIOTROPE": (874, 450, 1000),
    "HOLLYWOOD_CERISE": (956, 0, 631),
    "HONEYDEW": (941, 1000, 941),
    "HOOKER_GREEN": (286, 474, 419),
    "HOT_MAGENTA": (1000, 113, 807),
    "HOT_PINK": (1000, 411, 705),
    "HUNTER_GREEN": (207, 368, 231),
    "ICTERINE": (988, 968, 368),
    "INCHWORM": (698, 925, 364),
    "INDIA_GREEN": (74, 533, 31),
    "INDIAN_RED": (803, 360, 360),
    "INDIAN_YELLOW": (890, 658, 341),
    "INDIGO": (294, 0, 509),
    "INTERNATIONAL_KLEIN_BLUE": (0, 184, 654),
    "INTERNATIONAL_ORANGE": (1000, 309, 0),
    "IRIS": (352, 309, 811),
    "ISABELLINE": (956, 941, 925),
    "ISLAMIC_GREEN": (0, 564, 0),
    "IVORY": (1000, 1000, 941),
    "JADE": (0, 658, 419),
    "JASMINE": (972, 870, 494),
    "JASPER": (843, 231, 243),
    "JAZZBERRY_JAM": (647, 43, 368),
    "JONQUIL": (980, 854, 368),
    "JUNE_BUD": (741, 854, 341),
    "JUNGLE_GREEN": (160, 670, 529),
    "KU_CRIMSON": (909, 0, 50),
    "KELLY_GREEN": (298, 733, 90),
    "KHAKI": (764, 690, 568),
    "LA_SALLE_GREEN": (31, 470, 188),
    "LANGUID_LAVENDER": (839, 792, 866),
    "LAPIS_LAZULI": (149, 380, 611),
    "LASER_LEMON": (996, 996, 133),
    "LAUREL_GREEN": (662, 729, 615),
    "LAVA": (811, 62, 125),
    "LAVENDER": (901, 901, 980),
    "LAVENDER_BLUE": (800, 800, 1000),
    "LAVENDER_BLUSH": (1000, 941, 960),
    "LAVENDER_GRAY": (768, 764, 815),
    "LAVENDER_INDIGO": (580, 341, 921),
    "LAVENDER_MAGENTA": (933, 509, 933),
    "LAVENDER_MIST": (901, 901, 980),
    "LAVENDER_PINK": (984, 682, 823),
    "LAVENDER_PURPLE": (588, 482, 713),
    "LAVENDER_ROSE": (984, 627, 890),
    "LAWN_GREEN": (486, 988, 0),
    "LEMON": (1000, 968, 0),
    "LEMON_YELLOW": (1000, 956, 309),
    "LEMON_CHIFFON": (1000, 980, 803),
    "LEMON_LIME": (749, 1000, 0),
    "LIGHT_CRIMSON": (960, 411, 568),
    "LIGHT_THULIAN_PINK": (901, 560, 674),
    "LIGHT_APRICOT": (992, 835, 694),
    "LIGHT_BLUE": (678, 847, 901),
    "LIGHT_BROWN": (709, 396, 113),
    "LIGHT_CARMINE_PINK": (901, 403, 443),
    "LIGHT_CORAL": (941, 501, 501),
    "LIGHT_CORNFLOWER_BLUE": (576, 800, 917),
    "LIGHT_CYAN": (878, 1000, 1000),
    "LIGHT_FUCHSIA_PINK": (976, 517, 937),
    "LIGHT_ORANGE_YELLOW": (980, 980, 823),
    "LIGHT_GRAY": (827, 827, 827),
    "LIGHT_GREEN": (564, 933, 564),
    "LIGHT_KHAKI": (941, 901, 549),
    "LIGHT_PASTEL_PURPLE": (694, 611, 850),
    "LIGHT_PINK": (1000, 713, 756),
    "LIGHT_SALMON": (1000, 627, 478),
    "LIGHT_SALMON_PINK": (1000, 600, 600),
    "LIGHT_SEA_GREEN": (125, 698, 666),
    "LIGHT_SKY_BLUE": (529, 807, 980),
    "LIGHT_SLATE_GRAY": (466, 533, 600),
    "LIGHT_TAUPE": (701, 545, 427),
    "LIGHT_YELLOW": (1000, 1000, 929),
    "LILAC": (784, 635, 784),
    "LIME": (749, 1000, 0),
    "LIME_GREEN": (196, 803, 196),
    "LINCOLN_GREEN": (98, 349, 19),
    "LINEN": (980, 941, 901),
    "LION": (756, 603, 419),
    "LIVER": (325, 294, 309),
    "LUST": (901, 125, 125),
    "MSU_GREEN": (94, 270, 231),
    "MACARONI_AND_CHEESE": (1000, 741, 533),
    "MAGENTA": (1000, 0, 1000),
    "MAGIC_MINT": (666, 941, 819),
    "MAGNOLIA": (972, 956, 1000),
    "MAHOGANY": (752, 250, 0),
    "MAIZE": (984, 925, 364),
    "MAJORELLE_BLUE": (376, 313, 862),
    "MALACHITE": (43, 854, 317),
    "MANATEE": (592, 603, 666),
    "MANGO_TANGO": (1000, 509, 262),
    "MANTIS": (454, 764, 396),
    "MAROON": (501, 0, 0),
    "MAUVE": (878, 690, 1000),
    "MAUVE_TAUPE": (568, 372, 427),
    "MAUVELOUS": (937, 596, 666),
    "MAYA_BLUE": (450, 760, 984),
    "MEAT_BROWN": (898, 717, 231),
    "MEDIUM_PERSIAN_BLUE": (0, 403, 647),
    "MEDIUM_AQUAMARINE": (400, 866, 666),
    "MEDIUM_BLUE": (0, 0, 803),
    "MEDIUM_CANDY_APPLE_RED": (886, 23, 172),
    "MEDIUM_CARMINE": (686, 250, 207),
    "MEDIUM_CHAMPAGNE": (952, 898, 670),
    "MEDIUM_ELECTRIC_BLUE": (11, 313, 588),
    "MEDIUM_JUNGLE_GREEN": (109, 207, 176),
    "MEDIUM_LAVENDER_MAGENTA": (866, 627, 866),
    "MEDIUM_ORCHID": (729, 333, 827),
    "MEDIUM_PURPLE": (576, 439, 858),
    "MEDIUM_RED_VIOLET": (733, 200, 521),
    "MEDIUM_SEA_GREEN": (235, 701, 443),
    "MEDIUM_SLATE_BLUE": (482, 407, 933),
    "MEDIUM_SPRING_BUD": (788, 862, 529),
    "MEDIUM_SPRING_GREEN": (0, 980, 603),
    "MEDIUM_TAUPE": (403, 298, 278),
    "MEDIUM_TEAL_BLUE": (0, 329, 705),
    "MEDIUM_TURQUOISE": (282, 819, 800),
    "MEDIUM_VIOLET_RED": (780, 82, 521),
    "MELON": (992, 737, 705),
    "MIDNIGHT_BLUE": (98, 98, 439),
    "MIDNIGHT_GREEN": (0, 286, 325),
    "MIKADO_YELLOW": (1000, 768, 47),
    "MINT": (243, 705, 537),
    "MINT_CREAM": (960, 1000, 980),
    "MINT_GREEN": (596, 1000, 596),
    "MISTY_ROSE": (1000, 894, 882),
    "MOCCASIN": (980, 921, 843),
    "MODE_BEIGE": (588, 443, 90),
    "MOONSTONE_BLUE": (450, 662, 760),
    "MORDANT_RED_19": (682, 47, 0),
    "MOSS_GREEN": (678, 874, 678),
    "MOUNTAIN_MEADOW": (188, 729, 560),
    "MOUNTBATTEN_PINK": (600, 478, 552),
    "MULBERRY": (772, 294, 549),
    "MUNSELL": (949, 952, 956),
    "MUSTARD": (1000, 858, 345),
    "MYRTLE": (129, 258, 117),
    "NADESHIKO_PINK": (964, 678, 776),
    "NAPIER_GREEN": (164, 501, 0),
    "NAPLES_YELLOW": (980, 854, 368),
    "NAVAJO_WHITE": (1000, 870, 678),
    "NAVY_BLUE": (0, 0, 501),
    "NEON_CARROT": (1000, 639, 262),
    "NEON_FUCHSIA": (996, 349, 760),
    "NEON_GREEN": (223, 1000, 78),
    "NON_PHOTO_BLUE": (643, 866, 929),
    "NORTH_TEXAS_GREEN": (19, 564, 200),
    "OCEAN_BOAT_BLUE": (0, 466, 745),
    "OCHRE": (800, 466, 133),
    "OFFICE_GREEN": (0, 501, 0),
    "OLD_GOLD": (811, 709, 231),
    "OLD_LACE": (992, 960, 901),
    "OLD_LAVENDER": (474, 407, 470),
    "OLD_MAUVE": (403, 192, 278),
    "OLD_ROSE": (752, 501, 505),
    "OLIVE": (501, 501, 0),
    "OLIVE_DRAB": (419, 556, 137),
    "OLIVE_GREEN": (729, 721, 423),
    "OLIVINE": (603, 725, 450),
    "ONYX": (58, 58, 58),
    "OPERA_MAUVE": (717, 517, 654),
    "ORANGE": (1000, 647, 0),
    "ORANGE_YELLOW": (972, 835, 407),
    "ORANGE_PEEL": (1000, 623, 0),
    "ORANGE_RED": (1000, 270, 0),
    "ORCHID": (854, 439, 839),
    "OTTER_BROWN": (396, 262, 129),
    "OUTER_SPACE": (254, 290, 298),
    "OUTRAGEOUS_ORANGE": (1000, 431, 290),
    "OXFORD_BLUE": (0, 129, 278),
    "PACIFIC_BLUE": (109, 662, 788),
    "PAKISTAN_GREEN": (0, 400, 0),
    "PALATINATE_BLUE": (152, 231, 886),
    "PALATINATE_PURPLE": (407, 156, 376),
    "PALE_AQUA": (737, 831, 901),
    "PALE_BLUE": (686, 933, 933),
    "PALE_BROWN": (596, 462, 329),
    "PALE_CARMINE": (686, 250, 207),
    "PALE_CERULEAN": (607, 768, 886),
    "PALE_CHESTNUT": (866, 678, 686),
    "PALE_COPPER": (854, 541, 403),
    "PALE_CORNFLOWER_BLUE": (670, 803, 937),
    "PALE_GOLD": (901, 745, 541),
    "PALE_ORANGE": (933, 909, 666),
    "PALE_GREEN": (596, 984, 596),
    "PALE_LAVENDER": (862, 815, 1000),
    "PALE_MAGENTA": (976, 517, 898),
    "PALE_PINK": (980, 854, 866),
    "PALE_PLUM": (866, 627, 866),
    "PALE_RED_VIOLET": (858, 439, 576),
    "PALE_ROBIN_EGG_BLUE": (588, 870, 819),
    "PALE_SILVER": (788, 752, 733),
    "PALE_SPRING_BUD": (925, 921, 741),
    "PALE_TAUPE": (737, 596, 494),
    "PALE_VIOLET_RED": (858, 439, 576),
    "PANSY_PURPLE": (470, 94, 290),
    "PAPAYA_WHIP": (1000, 937, 835),
    "PARIS_GREEN": (313, 784, 470),
    "PASTEL_BLUE": (682, 776, 811),
    "PASTEL_BROWN": (513, 411, 325),
    "PASTEL_GRAY": (811, 811, 768),
    "PASTEL_GREEN": (466, 866, 466),
    "PASTEL_MAGENTA": (956, 603, 760),
    "PASTEL_ORANGE": (1000, 701, 278),
    "PASTEL_PINK": (1000, 819, 862),
    "PASTEL_PURPLE": (701, 619, 709),
    "PASTEL_RED": (1000, 411, 380),
    "PASTEL_VIOLET": (796, 600, 788),
    "PASTEL_YELLOW": (992, 992, 588),
    "PATRIARCH": (501, 0, 501),
    "PAYNE_GREY": (325, 407, 470),
    "PEACH": (1000, 898, 705),
    "PEACH_PUFF": (1000, 854, 725),
    "PEACH_YELLOW": (980, 874, 678),
    "PEAR": (819, 886, 192),
    "PEARL": (917, 878, 784),
    "PEARL_AQUA": (533, 847, 752),
    "PERIDOT": (901, 886, 0),
    "PERIWINKLE": (800, 800, 1000),
    "PERSIAN_BLUE": (109, 223, 733),
    "PERSIAN_INDIGO": (196, 70, 478),
    "PERSIAN_ORANGE": (850, 564, 345),
    "PERSIAN_PINK": (968, 498, 745),
    "PERSIAN_PLUM": (439, 109, 109),
    "PERSIAN_RED": (800, 200, 200),
    "PERSIAN_ROSE": (996, 156, 635),
    "PHLOX": (874, 0, 1000),
    "PHTHALO_BLUE": (0, 58, 537),
    "PHTHALO_GREEN": (70, 207, 141),
    "PIGGY_PINK": (992, 866, 901),
    "PINE_GREEN": (3, 474, 435),
    "PINK": (1000, 752, 796),
    "PINK_FLAMINGO": (988, 454, 992),
    "PINK_SHERBET": (968, 560, 654),
    "PINK_PEARL": (905, 674, 811),
    "PISTACHIO": (576, 772, 447),
    "PLATINUM": (898, 894, 886),
    "PLUM": (866, 627, 866),
    "PORTLAND_ORANGE": (1000, 352, 211),
    "POWDER_BLUE": (690, 878, 901),
    "PRINCETON_ORANGE": (1000, 560, 0),
    "PRUSSIAN_BLUE": (0, 192, 325),
    "PSYCHEDELIC_PURPLE": (874, 0, 1000),
    "PUCE": (800, 533, 600),
    "PUMPKIN": (1000, 458, 94),
    "PURPLE": (501, 0, 501),
    "PURPLE_HEART": (411, 207, 611),
    "PURPLE_MOUNTAINS_MAJESTY": (615, 505, 729),
    "PURPLE_MOUNTAIN_MAJESTY": (588, 470, 713),
    "PURPLE_PIZZAZZ": (996, 305, 854),
    "PURPLE_TAUPE": (313, 250, 301),
    "RACKLEY": (364, 541, 658),
    "RADICAL_RED": (1000, 207, 368),
    "RASPBERRY": (890, 43, 364),
    "RASPBERRY_GLACE": (568, 372, 427),
    "RASPBERRY_PINK": (886, 313, 596),
    "RASPBERRY_ROSE": (701, 266, 423),
    "RAW_SIENNA": (839, 541, 349),
    "RAZZLE_DAZZLE_ROSE": (1000, 200, 800),
    "RAZZMATAZZ": (890, 145, 419),
    "RED": (1000, 0, 0),
    "RED_ORANGE": (1000, 325, 286),
    "RED_BROWN": (647, 164, 164),
    "RED_VIOLET": (780, 82, 521),
    "RICH_BLACK": (0, 250, 250),
    "RICH_CARMINE": (843, 0, 250),
    "RICH_ELECTRIC_BLUE": (31, 572, 815),
    "RICH_LILAC": (713, 400, 823),
    "RICH_MAROON": (690, 188, 376),
    "RIFLE_GREEN": (254, 282, 200),
    "ROBINS_EGG_BLUE": (121, 807, 796),
    "ROSE": (1000, 0, 498),
    "ROSE_BONBON": (976, 258, 619),
    "ROSE_EBONY": (403, 282, 274),
    "ROSE_GOLD": (717, 431, 474),
    "ROSE_MADDER": (890, 149, 211),
    "ROSE_PINK": (1000, 400, 800),
    "ROSE_QUARTZ": (666, 596, 662),
    "ROSE_TAUPE": (564, 364, 364),
    "ROSE_VALE": (670, 305, 321),
    "ROSEWOOD": (396, 0, 43),
    "ROSSO_CORSA": (831, 0, 0),
    "ROSY_BROWN": (737, 560, 560),
    "ROYAL_AZURE": (0, 219, 658),
    "ROYAL_BLUE": (254, 411, 882),
    "ROYAL_FUCHSIA": (792, 172, 572),
    "ROYAL_PURPLE": (470, 317, 662),
    "RUBY": (878, 66, 372),
    "RUDDY": (1000, 0, 156),
    "RUDDY_BROWN": (733, 396, 156),
    "RUDDY_PINK": (882, 556, 588),
    "RUFOUS": (658, 109, 27),
    "RUSSET": (501, 274, 105),
    "RUST": (717, 254, 54),
    "SACRAMENTO_STATE_GREEN": (0, 337, 247),
    "SADDLE_BROWN": (545, 270, 74),
    "SAFETY_ORANGE": (1000, 403, 0),
    "SAFFRON": (956, 768, 188),
    "SAINT_PATRICK_BLUE": (137, 160, 478),
    "SALMON": (1000, 549, 411),
    "SALMON_PINK": (1000, 568, 643),
    "SAND": (760, 698, 501),
    "SAND_DUNE": (588, 443, 90),
    "SANDSTORM": (925, 835, 250),
    "SANDY_BROWN": (956, 643, 376),
    "SANDY_TAUPE": (588, 443, 90),
    "SAP_GREEN": (313, 490, 164),
    "SAPPHIRE": (58, 321, 729),
    "SATIN_SHEEN_GOLD": (796, 631, 207),
    "SCARLET": (1000, 141, 0),
    "SCHOOL_BUS_YELLOW": (1000, 847, 0),
    "SCREAMIN_GREEN": (462, 1000, 478),
    "SEA_BLUE": (0, 411, 580),
    "SEA_GREEN": (180, 545, 341),
    "SEAL_BROWN": (196, 78, 78),
    "SEASHELL": (1000, 960, 933),
    "SELECTIVE_YELLOW": (1000, 729, 0),
    "SEPIA": (439, 258, 78),
    "SHADOW": (541, 474, 364),
    "SHAMROCK": (270, 807, 635),
    "SHAMROCK_GREEN": (0, 619, 376),
    "SHOCKING_PINK": (988, 58, 752),
    "SIENNA": (533, 176, 90),
    "SILVER": (752, 752, 752),
    "SINOPIA": (796, 254, 43),
    "SKOBELOFF": (0, 454, 454),
    "SKY_BLUE": (529, 807, 921),
    "SKY_MAGENTA": (811, 443, 686),
    "SLATE_BLUE": (415, 352, 803),
    "SLATE_GRAY": (439, 501, 564),
    "SMALT": (0, 200, 600),
    "SMOKEY_TOPAZ": (576, 239, 254),
    "SMOKY_BLACK": (62, 47, 31),
    "SNOW": (1000, 980, 980),
    "SPIRO_DISCO_BALL": (58, 752, 988),
    "SPRING_BUD": (654, 988, 0),
    "SPRING_GREEN": (0, 1000, 498),
    "STEEL_BLUE": (274, 509, 705),
    "STIL_DE_GRAIN_YELLOW": (980, 854, 368),
    "STIZZA": (600, 0, 0),
    "STORMCLOUD": (0, 501, 501),
    "STRAW": (894, 850, 435),
    "SUNGLOW": (1000, 800, 200),
    "SUNSET": (980, 839, 647),
    "SUNSET_ORANGE": (992, 368, 325),
    "TAN": (823, 705, 549),
    "TANGELO": (976, 301, 0),
    "TANGERINE": (949, 521, 0),
    "TANGERINE_YELLOW": (1000, 800, 0),
    "TAUPE": (282, 235, 196),
    "TAUPE_GRAY": (545, 521, 537),
    "TAWNY": (803, 341, 0),
    "TEA_GREEN": (815, 941, 752),
    "TEA_ROSE": (956, 760, 760),
    "TEAL": (0, 501, 501),
    "TEAL_BLUE": (211, 458, 533),
    "TEAL_GREEN": (0, 427, 356),
    "TERRA_COTTA": (886, 447, 356),
    "THISTLE": (847, 749, 847),
    "THULIAN_PINK": (870, 435, 631),
    "TICKLE_ME_PINK": (988, 537, 674),
    "TIFFANY_BLUE": (39, 729, 709),
    "TIGER_EYE": (878, 552, 235),
    "TIMBERWOLF": (858, 843, 823),
    "TITANIUM_YELLOW": (933, 901, 0),
    "TOMATO": (1000, 388, 278),
    "TOOLBOX": (454, 423, 752),
    "TOPAZ": (1000, 784, 486),
    "TRACTOR_RED": (992, 54, 207),
    "TROLLEY_GREY": (501, 501, 501),
    "TROPICAL_RAIN_FOREST": (0, 458, 368),
    "TRUE_BLUE": (0, 450, 811),
    "TUFTS_BLUE": (254, 490, 756),
    "TUMBLEWEED": (870, 666, 533),
    "TURKISH_ROSE": (709, 447, 505),
    "TURQUOISE": (188, 835, 784),
    "TURQUOISE_BLUE": (0, 1000, 937),
    "TURQUOISE_GREEN": (627, 839, 705),
    "TUSCAN_RED": (400, 258, 301),
    "TWILIGHT_LAVENDER": (541, 286, 419),
    "TYRIAN_PURPLE": (400, 7, 235),
    "UA_BLUE": (0, 200, 666),
    "UA_RED": (850, 0, 298),
    "UCLA_BLUE": (325, 407, 584),
    "UCLA_GOLD": (1000, 701, 0),
    "UFO_GREEN": (235, 815, 439),
    "UP_FOREST_GREEN": (3, 266, 129),
    "UP_MAROON": (482, 66, 74),
    "USC_CARDINAL": (600, 0, 0),
    "USC_GOLD": (1000, 800, 0),
    "UBE": (533, 470, 764),
    "ULTRA_PINK": (1000, 435, 1000),
    "ULTRAMARINE": (70, 39, 560),
    "ULTRAMARINE_BLUE": (254, 400, 960),
    "UMBER": (388, 317, 278),
    "UNITED_NATIONS_BLUE": (356, 572, 898),
    "UNIVERSITY_OF_CALIFORNIA_GOLD": (717, 529, 152),
    "UNMELLOW_YELLOW": (1000, 1000, 400),
    "UPSDELL_RED": (682, 125, 160),
    "UROBILIN": (882, 678, 129),
    "UTAH_CRIMSON": (827, 0, 247),
    "VANILLA": (952, 898, 670),
    "VEGAS_GOLD": (772, 701, 345),
    "VENETIAN_RED": (784, 31, 82),
    "VERDIGRIS": (262, 701, 682),
    "VERMILION": (890, 258, 203),
    "VERONICA": (627, 125, 941),
    "VIOLET": (933, 509, 933),
    "VIOLET_BLUE": (196, 290, 698),
    "VIOLET_RED": (968, 325, 580),
    "VIRIDIAN": (250, 509, 427),
    "VIVID_AUBURN": (572, 152, 141),
    "VIVID_BURGUNDY": (623, 113, 207),
    "VIVID_CERISE": (854, 113, 505),
    "VIVID_TANGERINE": (1000, 627, 537),
    "VIVID_VIOLET": (623, 0, 1000),
    "WARM_BLACK": (0, 258, 258),
    "WATERSPOUT": (0, 1000, 1000),
    "WENGE": (392, 329, 321),
    "WHEAT": (960, 870, 701),
    "WHITE": (1000, 1000, 1000),
    "WHITE_SMOKE": (960, 960, 960),
    "WILD_STRAWBERRY": (1000, 262, 643),
    "WILD_WATERMELON": (988, 423, 521),
    "WILD_BLUE_YONDER": (635, 678, 815),
    "WINE": (447, 184, 215),
    "WISTERIA": (788, 627, 862),
    "XANADU": (450, 525, 470),
    "YALE_BLUE": (58, 301, 572),
    "YELLOW": (1000, 1000, 0),
    "YELLOW_ORANGE": (1000, 682, 258),
    "YELLOW_GREEN": (603, 803, 196),
    "ZAFFRE": (0, 78, 658),
    "ZINNWALDITE_BROWN": (172, 86, 31),
}

# Initiailize curses screen
stdscr = curses.initscr()

# Start 10-bit colors
curses.start_color()
curses.use_default_colors()

# Create a list of 10 bit rainbox colors
rainbow_color_names = [
    "RED",
    "SCARLET",
    "VERMILION",
    "ORANGE",
    "PEACH",
    "YELLOW",
    "LEMON",
    "LIME",
    "CHARTREUSE",
    "GREEN",
    "EMERALD",
    "TEAL",
    "CYAN",
    "SKY_BLUE",
    "BLUE",
    "NAVY_BLUE",
    "INDIGO",
    "VIOLET",
    "PERSIAN_ROSE",
    "ROSE",
    "MAROON",
    "BROWN",
    "BEIGE",
    "IVORY",
    "CREAM",
    "WHITE_SMOKE",
    "GRAY",
    "SILVER",
    "WHITE",
    "BLACK",
]

# init color, init color pair, and draw color string
for i, name in enumerate(rainbow_color_names, start=1):
    color_number = curses.COLORS - i # use last colors first
    pair_number =  i
    curses.init_color(color_number, *color_name_to_rgb[name])
    curses.init_pair(pair_number, color_number, COLOR_DEFAULT)
    try:
        stdscr.addstr(f"█ {name} █", curses.color_pair(pair_number))
    except curses.error:
        # Do not fail when drawn off screen
        continue

# Refresh the stdscr
stdscr.refresh()

# Wait for user input
stdscr.getch()

# Clean up
stdscr.clear()
curses.endwin()
aidanmelen
  • 6,194
  • 1
  • 23
  • 24