summaryrefslogtreecommitdiffstats
path: root/iredis/style.py
blob: 7262072831a195aa8210b0bfbef4ac9aed5ec061 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from prompt_toolkit.styles import Style, merge_styles

override_style = Style([("bottom-toolbar", "noreverse")])

style = REDIS_TOKEN = {
    "key": "#33aa33",
    "important-key": "#058B06",
    "pattern": "bold #33aa33",
    "string": "#FD971F",
    "member": "#FD971F",
    "command": "bold #008000",
    "integer": "#AE81FF",
    "const": "bold #AE81FF",
    "time": "#aa22ff",
    "double": "#bb6688",
    "nil": "#808080",
    "bit": "#8541FF",
    "field": "cyan",
    "group": "ansiblue",
    "username": "blue",
}

DOC = {
    "doccommand": "bold",
    "dockey": "#E6DB74",
    "code": "#aaaaaa",
    "h2": "bold #33aa33",
}

GROUP = {
    "group.cluster": "#E6DB74",
    "group.connection": "#E6DB74",
    "group.generic": "#E6DB74",
    "group.geo": "#E6DB74",
    "group.hash": "#E6DB74",
    "group.hyperloglog": "#E6DB74",
    "group.list": "#E6DB74",
    "group.pubsub": "#E6DB74",
    "group.server": "#E6DB74",
    "group.set": "#E6DB74",
    "group.sortedset": "#E6DB74",
    "group.stream": "#E6DB74",
    "group.string": "#E6DB74",
    "group.transactions": "#E6DB74",
}


STYLE_DICT = {
    # User input (default text).
    "": "",
    # Prompt.
    "rprompt": "bg:#ff0066 #ffffff",
    "hostname": "",
    "index": "#ff0000",
    "trailing-input": "bg:#ff0000 #000000",
    "password": "hidden",
    "success": "#00ff5f bold",
    "queued": "#32CD32 bold",
    "error": "#ff005f bold",
    "type": "#888",
    "channel": "#888",  # FIXME
    # colors below copied from mycli project, ~~love~~
    # bottom-toolbar
    "bottom-toolbar": "bg:#222222 #aaaaaa",
    "bottom-toolbar.on": "bg:#222222 #ffffff",
    "bottom-toolbar.off": "bg:#222222 #888888",
    "bottom-toolbar.loaded": "bg:#222222 #44aa44",
    "bottom-toolbar.since": "bg:#222222 #bc7a00",
    "bottom-toolbar.complexity": "bg:#222222 #666666",
    "bottom-toolbar.group": "bg:#222222 #d2413a bold",
    # completion
    "completion-menu.completion.current": "bg:#ffffff #000000",
    "completion-menu.completion": "bg:#008888 #ffffff",
    "completion-menu.meta.completion.current": "bg:#44aaaa #000000",
    "completion-menu.meta.completion": "bg:#448888 #ffffff",
    "completion-menu.multi-column-meta": "bg:#aaffff #000000",
    "scrollbar.arrow": "bg:#003333",
    "scrollbar": "bg:#00aaaa",
    "selected": "#ffffff bg:#6666aa",
    "search": "#ffffff bg:#4444aa",
    "search.current": "#ffffff bg:#44aa44",
    "search-toolbar": "noinherit bold",
    "search-toolbar.text": "nobold",
    "system-toolbar": "noinherit bold",
    "arg-toolbar": "noinherit bold",
    "arg-toolbar.text": "nobold",
}

BOTTOM_TOOLBAR_TOKEN = {
    # redis token
    f"bottom-toolbar.{token}": f"bg:#222222 {token_style}"
    for token, token_style in REDIS_TOKEN.items()
}

style.update(STYLE_DICT)
style.update(BOTTOM_TOOLBAR_TOKEN)
style.update(DOC)


STYLE = merge_styles([override_style, Style.from_dict(style)])