Skip to content

Commit 46e8d16

Browse files
committed
refactor: Extract gruvbox colors
1 parent 3c7bfcc commit 46e8d16

File tree

4 files changed

+48
-28
lines changed

4 files changed

+48
-28
lines changed

zulipterminal/config/themes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pygments.token import STANDARD_TYPES
44

55
from zulipterminal.config.color import term16
6-
from zulipterminal.themes import gruvbox, zt_blue, zt_dark, zt_light
6+
from zulipterminal.themes import gruvbox_dark, zt_blue, zt_dark, zt_light
77

88

99
StyleSpec = Union[
@@ -86,15 +86,15 @@
8686
# fmt: on
8787

8888
THEMES: Dict[str, Any] = {
89-
"gruvbox_dark": gruvbox,
89+
"gruvbox_dark": gruvbox_dark,
9090
"zt_dark": zt_dark,
9191
"zt_light": zt_light,
9292
"zt_blue": zt_blue,
9393
}
9494

9595
THEME_ALIASES = {
9696
"default": "zt_dark",
97-
"gruvbox": "gruvbox_dark",
97+
"gruvbox_dark": "gruvbox_dark",
9898
"light": "zt_light",
9999
"blue": "zt_blue",
100100
}

zulipterminal/themes/THEME_CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ If BOLD is something that is not needed, just use:
2323
from zulipterminal.config.color import DefaultColor as Color
2424
```
2525

26-
Likewise, to use a color scheme from any other theme like Gruvbox, use:
26+
Likewise, to use a color scheme from any other theme like Gruvbox (for which the colors are defined in colors_gruvbox.py), use:
2727

2828
```python
29-
from zulipterminal.themes.gruvbox import Color
29+
from zulipterminal.themes.colors_gruvbox import DefaultBoldColor
3030
```
3131

3232
---
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
COLOR
3+
-----
4+
Contains color definitions or functions common across gruvbox themes.
5+
For further details on themefiles look at the theme contribution guide.
6+
-------
7+
This theme uses the official gruvbox color scheme.
8+
For color reference see:
9+
https://github.com/morhetz/gruvbox/blob/master/colors/gruvbox.vim
10+
"""
11+
from enum import Enum
12+
13+
from zulipterminal.config.color import color_properties
14+
15+
16+
# fmt: off
17+
# NOTE: The 24bit color codes use 256 color which can be
18+
# enhanced to be truly 24bit.
19+
# NOTE: The 256code format can be moved to h0-255 to
20+
# make use of the complete range instead of only 216 colors.
21+
22+
class GruvBoxColor(Enum):
23+
# color = 16code 256code 24code
24+
DEFAULT = 'default default default'
25+
DARK0_HARD = 'black h234 #1d2021'
26+
GRAY_244 = 'dark_gray h244 #928374'
27+
LIGHT2 = 'white h250 #d5c4a1'
28+
LIGHT4 = 'light_gray h248 #bdae93'
29+
BRIGHT_BLUE = 'light_blue h109 #83a598'
30+
BRIGHT_GREEN = 'light_green h142 #b8bb26'
31+
BRIGHT_RED = 'light_red h167 #fb4934'
32+
NEUTRAL_PURPLE = 'light_magenta h132 #b16286'
33+
NEUTRAL_BLUE = 'dark_cyan h66 #458588'
34+
NEUTRAL_YELLOW = 'yellow h172 #d79921'
35+
FADED_BLUE = 'dark_blue h24 #076678'
36+
FADED_YELLOW = 'brown h136 #b57614'
37+
FADED_RED = 'dark_red h88 #9d0006'
38+
# fmt: on
39+
40+
41+
DefaultBoldColor = color_properties(GruvBoxColor, "BOLD")

zulipterminal/themes/gruvbox.py renamed to zulipterminal/themes/gruvbox_dark.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
GRUVBOX
2+
GRUVBOX DARK
33
-------
44
This theme uses the official gruvbox color scheme.
55
For color reference see:
@@ -11,34 +11,13 @@
1111
1212
For further details on themefiles look at the theme contribution guide
1313
"""
14-
from enum import Enum
1514

1615
from pygments.styles.solarized import SolarizedDarkStyle
1716

18-
from zulipterminal.config.color import color_properties
17+
from zulipterminal.themes.colors_gruvbox import DefaultBoldColor as Color
1918

2019

2120
# fmt: off
22-
class GruvBoxColor(Enum):
23-
# color = 16code 256code 24code
24-
DEFAULT = 'default default default'
25-
DARK0_HARD = 'black h234 #1d2021'
26-
GRAY_244 = 'dark_gray h244 #928374'
27-
LIGHT2 = 'white h250 #d5c4a1'
28-
LIGHT4 = 'light_gray h248 #bdae93'
29-
BRIGHT_BLUE = 'light_blue h109 #83a598'
30-
BRIGHT_GREEN = 'light_green h142 #b8bb26'
31-
BRIGHT_RED = 'light_red h167 #fb4934'
32-
NEUTRAL_PURPLE = 'light_magenta h132 #b16286'
33-
NEUTRAL_BLUE = 'dark_cyan h66 #458588'
34-
NEUTRAL_YELLOW = 'yellow h172 #d79921'
35-
FADED_BLUE = 'dark_blue h24 #076678'
36-
FADED_YELLOW = 'brown h136 #b57614'
37-
FADED_RED = 'dark_red h88 #9d0006'
38-
39-
40-
Color = color_properties(GruvBoxColor, 'BOLD')
41-
4221

4322
STYLES = {
4423
# style_name : foreground background

0 commit comments

Comments
 (0)