Skip to content

Commit

Permalink
new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohitth007 committed Jun 10, 2021
1 parent 4c787e8 commit 6e96045
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 291 deletions.
334 changes: 70 additions & 264 deletions zulipterminal/config/gruvbox.py
Original file line number Diff line number Diff line change
@@ -1,267 +1,73 @@
# Colors used in gruvbox-256
# See https://github.com/morhetz/gruvbox/blob/master/colors/gruvbox.vim
BLACK = "h234" # dark0_hard
WHITE = "h246" # light4_256
WHITEBOLD = f"{WHITE}, bold"
DARKBLUE = "h24" # faded_blue
DARKRED = "h88" # faded_red
LIGHTBLUE = "h109" # bright_blue
LIGHTBLUEBOLD = f"{LIGHTBLUE}, bold"
YELLOW = "h172" # neutral_yellow
YELLOWBOLD = f"{YELLOW}, bold"
LIGHTGREEN = "h142" # bright_green
LIGHTRED = "h167" # bright_red
LIGHTREDBOLD = f"{LIGHTRED}, bold"
GRAY = "h244" # gray_244
LIGHTMAGENTA = "h132" # neutral_purple
LIGHTMAGENTABOLD = f"{LIGHTMAGENTA}, bold"
from enum import Enum

# Colors used in gruvbox_dark24
BLACK24 = "#1d2021" # dark0_hard
WHITE24 = "#a89984" # light4
WHITEBOLD24 = f"{WHITE24}, bold"
DARKBLUE24 = "#076678" # faded_blue
DARKRED24 = "#9d0006" # faded_red
LIGHTBLUE24 = "#83a598" # bright_blue
LIGHTBLUEBOLD24 = f"{LIGHTBLUE24}, bold"
YELLOW24 = "#d79921" # neutral_yellow
YELLOWBOLD24 = f"{YELLOW24}, bold"
LIGHTGREEN24 = "#b8bb26" # bright_green
LIGHTRED24 = "#fb4934" # bright_red
LIGHTREDBOLD24 = f"{LIGHTRED24}, bold"
GRAY24 = "#928374" # gray_244
LIGHTMAGENTA24 = "#b16286" # neutral_purple
LIGHTMAGENTABOLD24 = f"{LIGHTMAGENTA24}, bold"
from zulipterminal.config.themes import add_color_prop

styles = {
None: {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"selected": {
16: ["black", "white"],
256: [BLACK, WHITE],
24: [BLACK24, WHITE24],
},
"msg_selected": {
16: ["black", "white"],
256: [BLACK, WHITE],
24: [BLACK24, WHITE24],
},
"header": {
16: ["dark cyan", "dark blue"],
256: ["dark cyan", DARKBLUE],
24: ["dark cyan", DARKBLUE24],
},
"general_narrow": {
16: ["white", "dark blue"],
256: [WHITE, DARKBLUE],
24: [WHITE24, DARKBLUE24],
},
"general_bar": {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"name": {
16: ["yellow, bold", "black"],
256: [YELLOWBOLD, BLACK],
24: [YELLOWBOLD24, BLACK24],
},
"unread": {
16: ["light magenta", "black"],
256: [LIGHTMAGENTA, BLACK],
24: [LIGHTMAGENTA24, BLACK24],
},
"user_active": {
16: ["light green", "black"],
256: [LIGHTGREEN, BLACK],
24: [LIGHTGREEN24, BLACK24],
},
"user_idle": {
16: ["yellow", "black"],
256: [YELLOW, BLACK],
24: [YELLOW24, BLACK24],
},
"user_offline": {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"user_inactive": {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"title": {
16: ["white, bold", "black"],
256: [WHITEBOLD, BLACK],
24: [WHITEBOLD24, BLACK24],
},
"column_title": {
16: ["white, bold", "black"],
256: [WHITEBOLD, BLACK],
24: [WHITEBOLD24, BLACK24],
},
"time": {
16: ["light blue", "black"],
256: [LIGHTBLUE, BLACK],
24: [LIGHTBLUE24, BLACK24],
},
"bar": {
16: ["white", "dark gray"],
256: [WHITE, GRAY],
24: [WHITE24, GRAY24],
},
"popup_contrast": {
16: ["black", "dark gray"],
256: [BLACK, GRAY],
24: [BLACK24, GRAY24],
},
"msg_emoji": {
16: ["light magenta", "black"],
256: [LIGHTMAGENTA, BLACK],
24: [LIGHTMAGENTA24, BLACK24],
},
"reaction": {
16: ["light magenta, bold", "black"],
256: [LIGHTMAGENTABOLD, BLACK],
24: [LIGHTMAGENTABOLD24, BLACK24],
},
"reaction_mine": {
16: ["black", "light magenta"],
256: [BLACK, LIGHTMAGENTA],
24: [BLACK24, LIGHTMAGENTA24],
},
"msg_mention": {
16: ["light red, bold", "black"],
256: [LIGHTREDBOLD, BLACK],
24: [LIGHTREDBOLD24, BLACK24],
},
"msg_link": {
16: ["light blue", "black"],
256: [LIGHTBLUE, BLACK],
24: [LIGHTBLUE24, BLACK24],
},
"msg_link_index": {
16: ["light blue, bold", "black"],
256: [LIGHTBLUEBOLD, BLACK],
24: [LIGHTBLUEBOLD24, BLACK24],
},
"msg_quote": {
16: ["brown", "black"],
256: ["brown", BLACK],
24: ["brown", BLACK24],
},
"msg_code": {
16: ["black", "white"],
256: [BLACK, WHITE],
24: [BLACK24, WHITE24],
},
"msg_bold": {
16: ["white, bold", "black"],
256: [WHITEBOLD, BLACK],
24: [WHITEBOLD24, BLACK24],
},
"msg_time": {
16: ["black", "white"],
256: [BLACK, WHITE],
24: [BLACK24, WHITE24],
},
"footer": {
16: ["white", "dark red"],
256: [WHITE, DARKRED],
24: [WHITE24, DARKRED24],
},
"starred": {
16: ["light red, bold", "black"],
256: [LIGHTREDBOLD, BLACK],
24: [LIGHTREDBOLD24, BLACK24],
},
"popup_category": {
16: ["light blue, bold", "black"],
256: [LIGHTBLUE, BLACK],
24: [LIGHTBLUE24, BLACK24],
},
"unread_count": {
16: ["yellow", "black"],
256: [YELLOW, BLACK],
24: [YELLOW24, BLACK24],
},
"starred_count": {
16: ["light gray", "black"],
256: [GRAY, BLACK],
24: [WHITE24, BLACK24],
},
"table_head": {
16: ["white, bold", "black"],
256: [WHITEBOLD, BLACK],
24: [WHITEBOLD24, BLACK24],
},
"filter_results": {
16: ["black", "light green"],
256: [BLACK, LIGHTGREEN],
24: [BLACK24, LIGHTGREEN24],
},
"edit_topic": {
16: ["black", "dark gray"],
256: [BLACK, GRAY],
24: [BLACK24, GRAY24],
},
"edit_tag": {
16: ["black", "dark gray"],
256: [BLACK, GRAY],
24: [BLACK24, GRAY24],
},
"edit_author": {
16: ["yellow", "black"],
256: [YELLOW, BLACK],
24: [YELLOW24, BLACK24],
},
"edit_time": {
16: ["light blue", "black"],
256: [LIGHTBLUE, BLACK],
24: [LIGHTBLUE24, BLACK24],
},
"current_user": {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"muted": {
16: ["light blue", "black"],
256: [LIGHTBLUE, BLACK],
24: [LIGHTBLUE24, BLACK24],
},
"popup_border": {
16: ["white", "black"],
256: [WHITE, BLACK],
24: [WHITE24, BLACK24],
},
"area:help": {
16: ["black", "light green"],
256: [BLACK, LIGHTGREEN],
24: [BLACK24, LIGHTGREEN24],
},
"area:msg": {
16: ["black", "light red"],
256: [BLACK, LIGHTRED],
24: [BLACK24, LIGHTRED24],
},
"area:stream": {
16: ["black", "light blue"],
256: [BLACK, LIGHTBLUE],
24: [BLACK24, LIGHTBLUE24],
},
"area:error": {
16: ["white", "dark red"],
256: [WHITE, DARKRED],
24: [WHITE24, DARKRED24],
},
"search_error": {
16: ["light red", "black"],
256: [LIGHTRED, BLACK],
24: [LIGHTRED24, BLACK24],
},

# fmt: off
class Color(Enum):
BLACK = 'h234 #1d2021'
WHITE = 'h246 #a89984'
DARK_BLUE = 'h24 #076678'
DARK_RED = 'h88 #9d0006'
LIGHT_BLUE = 'h109 #83a598'
YELLOW = 'h172 #d79921'
LIGHT_GREEN = 'h142 #b8bb26'
LIGHT_RED = 'h167 #fb4934'
DARK_GRAY = 'h244 #928374'
LIGHT_MAGENTA = 'h132 #b16286'
DARK_CYAN = 'dark_cyan dark_cyan'
BROWN = 'brown brown'

Color = add_color_prop(Color, "BOLD")
# Use dunder for bold
# Eg: Color.YELLOW__BOLD

STYLES = {
None : (Color.WHITE, Color.BLACK),
'selected' : (Color.BLACK, Color.WHITE),
'msg_selected' : (Color.BLACK, Color.WHITE),
'header' : (Color.DARK_CYAN, Color.DARK_BLUE),
'general_narrow' : (Color.WHITE, Color.DARK_BLUE),
'general_bar' : (Color.WHITE, Color.BLACK),
'name' : (Color.YELLOW__BOLD, Color.BLACK),
'unread' : (Color.LIGHT_MAGENTA, Color.BLACK),
'user_active' : (Color.LIGHT_GREEN, Color.BLACK),
'user_idle' : (Color.YELLOW, Color.BLACK),
'user_offline' : (Color.WHITE, Color.BLACK),
'user_inactive' : (Color.WHITE, Color.BLACK),
'title' : (Color.WHITE__BOLD, Color.BLACK),
'column_title' : (Color.WHITE__BOLD, Color.BLACK),
'time' : (Color.LIGHT_BLUE, Color.BLACK),
'bar' : (Color.WHITE, Color.DARK_GRAY),
'popup_contrast' : (Color.BLACK, Color.DARK_GRAY),
'msg_emoji' : (Color.LIGHT_MAGENTA, Color.BLACK),
'reaction' : (Color.LIGHT_MAGENTA__BOLD, Color.BLACK),
'reaction_mine' : (Color.BLACK, Color.LIGHT_MAGENTA),
'msg_mention' : (Color.LIGHT_RED__BOLD, Color.BLACK),
'msg_link' : (Color.LIGHT_BLUE, Color.BLACK),
'msg_link_index' : (Color.LIGHT_BLUE__BOLD, Color.BLACK),
'msg_quote' : (Color.BROWN, Color.BLACK),
'msg_code' : (Color.BLACK, Color.WHITE),
'msg__bold' : (Color.WHITE__BOLD, Color.BLACK),
'msg_time' : (Color.BLACK, Color.WHITE),
'footer' : (Color.WHITE, Color.DARK_RED),
'starred' : (Color.LIGHT_RED__BOLD, Color.BLACK),
'popup_category' : (Color.LIGHT_BLUE, Color.BLACK),
'unread_count' : (Color.YELLOW, Color.BLACK),
'starred_count' : (Color.DARK_GRAY, Color.BLACK),
'table_head' : (Color.WHITE__BOLD, Color.BLACK),
'filter_results' : (Color.BLACK, Color.LIGHT_GREEN),
'edit_topic' : (Color.BLACK, Color.DARK_GRAY),
'edit_tag' : (Color.BLACK, Color.DARK_GRAY),
'edit_author' : (Color.YELLOW, Color.BLACK),
'edit_time' : (Color.LIGHT_BLUE, Color.BLACK),
'current_user' : (Color.WHITE, Color.BLACK),
'muted' : (Color.LIGHT_BLUE, Color.BLACK),
'popup_border' : (Color.WHITE, Color.BLACK),
'area:help' : (Color.BLACK, Color.LIGHT_GREEN),
'area:msg' : (Color.BLACK, Color.LIGHT_RED),
'area:stream' : (Color.BLACK, Color.LIGHT_BLUE),
'area:error' : (Color.WHITE, Color.DARK_RED),
'search_error' : (Color.LIGHT_RED, Color.BLACK),
}
# fmt: on
Loading

0 comments on commit 6e96045

Please sign in to comment.