-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNodeColorer.py
33 lines (27 loc) · 1.15 KB
/
NodeColorer.py
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
from colorama import Fore, Style, init
from CommitNode import CommitNode
# Colors are ☣
# BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET
# Styles are
# NORMAL, BRIGHT
# everything else is not supported in Windows.
class NodeColorer:
GrayedNodeColor = Fore.LIGHTBLACK_EX
NamedNodeColor = Fore.LIGHTBLUE_EX
CheckedOutNodeColor = Fore.LIGHTGREEN_EX
DefaultNodeColor = Fore.WHITE
UpToDateStatusColor = Fore.GREEN + Style.BRIGHT
def __init__(self):
init(autoreset=True)
def color_name(self, name, has_name, is_checked_out, should_gray_out):
if should_gray_out:
return NodeColorer.GrayedNodeColor + name + Fore.RESET
if is_checked_out:
return NodeColorer.CheckedOutNodeColor + name + Fore.RESET
if has_name:
return NodeColorer.NamedNodeColor + name + Fore.RESET
return NodeColorer.DefaultNodeColor + name + Fore.RESET
def color_status(self, status):
return NodeColorer.UpToDateStatusColor + status + Fore.RESET
def color_excluded_parents(self, excluded_parents):
return NodeColorer.GrayedNodeColor + excluded_parents + Fore.RESET