summary refs log tree commit diff
path: root/dot_ipython/profile_default/startup/10_colours.py
blob: eb6e5a85c8f447106d2de69edd64a2c3db33769d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""Simple colours for colourful colouring."""


class FG:
    RESET = "\u001b[0m"

    DARK_BLACK = BLACK = "\u001b[30m"
    DARK_RED = "\u001b[31m"
    DARK_GREEN = "\u001b[32m"
    DARK_YELLOW = BROWN = "\u001b[33m"
    DARK_BLUE = BLUE = "\u001b[34m"
    DARK_MAGENTA = PURPLE = "\u001b[35m"
    DARK_CYAN = "\u001b[36m"
    DARK_WHITE = "\u001b[37m"

    BRIGHT_BLACK = GRAY = GREY = "\u001b[30;1m"
    BRIGHT_RED = RED = "\u001b[31;1m"
    BRIGHT_GREEN = GREEN = "\u001b[32;1m"
    BRIGHT_YELLOW = YELLOW = "\u001b[33;1m"
    BRIGHT_BLUE = "\u001b[34;1m"
    BRIGHT_MAGENTA = MAGENTA = "\u001b[35;1m"
    BRIGHT_CYAN = CYAN = "\u001b[36;1m"
    BRIGHT_WHITE = WHITE = "\u001b[37;1m"

    def __getitem__(self, rgb):
        r, g, b = rgb
        return f"\u001b[38;2;{r};{g};{b}m"


class BG:
    RESET = "\u001b[0m"

    DARK_BLACK = BLACK = "\u001b[40m"
    DARK_RED = "\u001b[41m"
    DARK_GREEN = "\u001b[42m"
    DARK_YELLOW = BROWN = "\u001b[44m"
    DARK_BLUE = BLUE = "\u001b[44m"
    DARK_MAGENTA = PURPLE = "\u001b[45m"
    DARK_CYAN = "\u001b[46m"
    DARK_WHITE = "\u001b[47m"

    BRIGHT_BLACK = GRAY = GREY = "\u001b[40;1m"
    BRIGHT_RED = RED = "\u001b[41;1m"
    BRIGHT_GREEN = GREEN = "\u001b[42;1m"
    BRIGHT_YELLOW = YELLOW = "\u001b[44;1m"
    BRIGHT_BLUE = "\u001b[44;1m"
    BRIGHT_MAGENTA = MAGENTA = "\u001b[45;1m"
    BRIGHT_CYAN = CYAN = "\u001b[46;1m"
    BRIGHT_WHITE = WHITE = "\u001b[47;1m"

    def __getitem__(self, rgb):
        r, g, b = rgb
        return f"\u001b[48;2;{r};{g};{b}m"


_summarise_startup()