Last active
September 27, 2023 18:39
-
-
Save johnnymo87/9a43f7bcdca5c3c3d36e4158039bd22b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number | name | |
---|---|---|
0 | Black | |
1 | Maroon | |
2 | Green | |
3 | Olive | |
4 | Navy | |
5 | Purple | |
6 | Teal | |
7 | Silver | |
8 | Grey | |
9 | Red | |
10 | Lime | |
11 | Yellow | |
12 | Blue | |
13 | Fuchsia | |
14 | Aqua | |
15 | White | |
16 | Grey0 | |
17 | NavyBlue | |
18 | DarkBlue | |
19 | Blue3 | |
20 | Blue3 | |
21 | Blue1 | |
22 | DarkGreen | |
23 | DeepSkyBlue4 | |
24 | DeepSkyBlue4 | |
25 | DeepSkyBlue4 | |
26 | DodgerBlue3 | |
27 | DodgerBlue2 | |
28 | Green4 | |
29 | SpringGreen4 | |
30 | Turquoise4 | |
31 | DeepSkyBlue3 | |
32 | DeepSkyBlue3 | |
33 | DodgerBlue1 | |
34 | Green3 | |
35 | SpringGreen3 | |
36 | DarkCyan | |
37 | LightSeaGreen | |
38 | DeepSkyBlue2 | |
39 | DeepSkyBlue1 | |
40 | Green3 | |
41 | SpringGreen3 | |
42 | SpringGreen2 | |
43 | Cyan3 | |
44 | DarkTurquoise | |
45 | Turquoise2 | |
46 | Green1 | |
47 | SpringGreen2 | |
48 | SpringGreen1 | |
49 | MediumSpringGreen | |
50 | Cyan2 | |
51 | Cyan1 | |
52 | DarkRed | |
53 | DeepPink4 | |
54 | Purple4 | |
55 | Purple4 | |
56 | Purple3 | |
57 | BlueViolet | |
58 | Orange4 | |
59 | Grey37 | |
60 | MediumPurple4 | |
61 | SlateBlue3 | |
62 | SlateBlue3 | |
63 | RoyalBlue1 | |
64 | Chartreuse4 | |
65 | DarkSeaGreen4 | |
66 | PaleTurquoise4 | |
67 | SteelBlue | |
68 | SteelBlue3 | |
69 | CornflowerBlue | |
70 | Chartreuse3 | |
71 | DarkSeaGreen4 | |
72 | CadetBlue | |
73 | CadetBlue | |
74 | SkyBlue3 | |
75 | SteelBlue1 | |
76 | Chartreuse3 | |
77 | PaleGreen3 | |
78 | SeaGreen3 | |
79 | Aquamarine3 | |
80 | MediumTurquoise | |
81 | SteelBlue1 | |
82 | Chartreuse2 | |
83 | SeaGreen2 | |
84 | SeaGreen1 | |
85 | SeaGreen1 | |
86 | Aquamarine1 | |
87 | DarkSlateGray2 | |
88 | DarkRed | |
89 | DeepPink4 | |
90 | DarkMagenta | |
91 | DarkMagenta | |
92 | DarkViolet | |
93 | Purple | |
94 | Orange4 | |
95 | LightPink4 | |
96 | Plum4 | |
97 | MediumPurple3 | |
98 | MediumPurple3 | |
99 | SlateBlue1 | |
100 | Yellow4 | |
101 | Wheat4 | |
102 | Grey53 | |
103 | LightSlateGrey | |
104 | MediumPurple | |
105 | LightSlateBlue | |
106 | Yellow4 | |
107 | DarkOliveGreen3 | |
108 | DarkSeaGreen | |
109 | LightSkyBlue3 | |
110 | LightSkyBlue3 | |
111 | SkyBlue2 | |
112 | Chartreuse2 | |
113 | DarkOliveGreen3 | |
114 | PaleGreen3 | |
115 | DarkSeaGreen3 | |
116 | DarkSlateGray3 | |
117 | SkyBlue1 | |
118 | Chartreuse1 | |
119 | LightGreen | |
120 | LightGreen | |
121 | PaleGreen1 | |
122 | Aquamarine1 | |
123 | DarkSlateGray1 | |
124 | Red3 | |
125 | DeepPink4 | |
126 | MediumVioletRed | |
127 | Magenta3 | |
128 | DarkViolet | |
129 | Purple | |
130 | DarkOrange3 | |
131 | IndianRed | |
132 | HotPink3 | |
133 | MediumOrchid3 | |
134 | MediumOrchid | |
135 | MediumPurple2 | |
136 | DarkGoldenrod | |
137 | LightSalmon3 | |
138 | RosyBrown | |
139 | Grey63 | |
140 | MediumPurple2 | |
141 | MediumPurple1 | |
142 | Gold3 | |
143 | DarkKhaki | |
144 | NavajoWhite3 | |
145 | Grey69 | |
146 | LightSteelBlue3 | |
147 | LightSteelBlue | |
148 | Yellow3 | |
149 | DarkOliveGreen3 | |
150 | DarkSeaGreen3 | |
151 | DarkSeaGreen2 | |
152 | LightCyan3 | |
153 | LightSkyBlue1 | |
154 | GreenYellow | |
155 | DarkOliveGreen2 | |
156 | PaleGreen1 | |
157 | DarkSeaGreen2 | |
158 | DarkSeaGreen1 | |
159 | PaleTurquoise1 | |
160 | Red3 | |
161 | DeepPink3 | |
162 | DeepPink3 | |
163 | Magenta3 | |
164 | Magenta3 | |
165 | Magenta2 | |
166 | DarkOrange3 | |
167 | IndianRed | |
168 | HotPink3 | |
169 | HotPink2 | |
170 | Orchid | |
171 | MediumOrchid1 | |
172 | Orange3 | |
173 | LightSalmon3 | |
174 | LightPink3 | |
175 | Pink3 | |
176 | Plum3 | |
177 | Violet | |
178 | Gold3 | |
179 | LightGoldenrod3 | |
180 | Tan | |
181 | MistyRose3 | |
182 | Thistle3 | |
183 | Plum2 | |
184 | Yellow3 | |
185 | Khaki3 | |
186 | LightGoldenrod2 | |
187 | LightYellow3 | |
188 | Grey84 | |
189 | LightSteelBlue1 | |
190 | Yellow2 | |
191 | DarkOliveGreen1 | |
192 | DarkOliveGreen1 | |
193 | DarkSeaGreen1 | |
194 | Honeydew2 | |
195 | LightCyan1 | |
196 | Red1 | |
197 | DeepPink2 | |
198 | DeepPink1 | |
199 | DeepPink1 | |
200 | Magenta2 | |
201 | Magenta1 | |
202 | OrangeRed1 | |
203 | IndianRed1 | |
204 | IndianRed1 | |
205 | HotPink | |
206 | HotPink | |
207 | MediumOrchid1 | |
208 | DarkOrange | |
209 | Salmon1 | |
210 | LightCoral | |
211 | PaleVioletRed1 | |
212 | Orchid2 | |
213 | Orchid1 | |
214 | Orange1 | |
215 | SandyBrown | |
216 | LightSalmon1 | |
217 | LightPink1 | |
218 | Pink1 | |
219 | Plum1 | |
220 | Gold1 | |
221 | LightGoldenrod2 | |
222 | LightGoldenrod2 | |
223 | NavajoWhite1 | |
224 | MistyRose1 | |
225 | Thistle1 | |
226 | Yellow1 | |
227 | LightGoldenrod1 | |
228 | Khaki1 | |
229 | Wheat1 | |
230 | Cornsilk1 | |
231 | Grey100 | |
232 | Grey3 | |
233 | Grey7 | |
234 | Grey11 | |
235 | Grey15 | |
236 | Grey19 | |
237 | Grey23 | |
238 | Grey27 | |
239 | Grey30 | |
240 | Grey35 | |
241 | Grey39 | |
242 | Grey42 | |
243 | Grey46 | |
244 | Grey50 | |
245 | Grey54 | |
246 | Grey58 | |
247 | Grey62 | |
248 | Grey66 | |
249 | Grey70 | |
250 | Grey74 | |
251 | Grey78 | |
252 | Grey82 | |
253 | Grey85 | |
254 | Grey89 | |
255 | Grey93 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ALIAS {colortest} | |
{ | |
#showme <G02>bg Grey11; | |
#showme <G03>bg Grey15; | |
#showme <aaa><G21>fg Grey0 bg Grey85; | |
#showme <ABC>bg DeepSkyBlue4; | |
#showme <edd><G07>fg MistyRose3 bg Grey30; | |
#showme <eac><BAB>fg DeepPink3 bg DeepPink4; | |
#showme <CCC><188>bg Grey53 (bold); | |
#showme <fdf><CAB>fg Plum1 bg DeepPink4; | |
#showme <fad><AAA><188>fg DeepPink1 bg Grey0 (bold); | |
#showme <bcd><AAA>fg SteelBlue bg Grey0; | |
#showme <bcd><AAA>fg SteelBlue bg Grey0; | |
#showme <g12><G00>fg Grey50 bg Grey3; | |
#showme <efd><AAA>fg DarkSeaGreen1 bg Grey0; | |
#showme <g01><FCA><188>fg Grey7 bg DarkOrange (bold); | |
#showme <bef><AAA>fg SteelBlue1 bg Grey0; | |
#showme <g23><G10>fg Grey93 bg Grey42; | |
#showme <G00>bg Grey3; | |
#showme <aaa><FEC>fg Black bg LightGoldenrod2; | |
#showme <cfa><G03>fg Chartreuse1 bg Grey15; | |
#showme <BAA>bg DarkRed; | |
#showme <AAB>bg NavyBlue; | |
#showme <AAB>bg NavyBlue; | |
#showme <g06><G21>fg Grey27 bg Grey85; | |
#showme <g12><G00>fg Grey50 bg Grey3; | |
#showme <fff><G00><188>fg Grey100 bg Grey3 (bold); | |
#showme <g12><G00><188>fg Grey50 bg Grey3 (bold); | |
#showme <G06>bg Grey27; | |
#showme <G03>bg Grey15; | |
#showme <fff><G06><188>fg Grey100 bg Grey27 (bold); | |
#showme <bef><AAA>fg SteelBlue1 bg Grey0; | |
#showme <G04>bg Grey19; | |
#showme <G04>bg Grey19; | |
#showme <g18><G04>fg Grey74 bg Grey19; | |
#showme <g20><G02>fg Grey82 bg Grey11; | |
#showme <G04>bg Grey19; | |
#showme <dab><G01>fg DeepPink4 bg Grey7; | |
#showme <fec><G01>fg LightGoldenrod2 bg Grey7; | |
#showme <G06>bg Grey27; | |
#showme <g07><G03>fg Grey30 bg Grey15; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import pandas as pd | |
# Load the data | |
data = pd.read_csv('molokai.csv') | |
legend = pd.read_csv('256_color_names.csv') | |
# Convert the legend to a dictionary for easier lookup | |
legend_dict = dict(zip(legend.number, legend.name)) | |
def color256_to_tintin(color): | |
if not 0 <= color <= 255: | |
raise ValueError('Invalid 256 color value: {}'.format(color)) | |
# There are 24 grayscale colors, zero-indexed. | |
if 232 <= color <= 255: | |
gray = color - 232 | |
# Left pad the number with a zero if it's a single digit. | |
# Prefix it with 'g' to indicate grayscale. | |
return "g{:02}".format(gray) | |
# There 216 RGB colors | |
if 16 <= color <= 231: | |
color -= 16 | |
r = color // 36 | |
g = (color % 36) // 6 | |
b = color % 6 | |
if not 0 <= r <= 5: | |
raise ValueError('Invalid r value: {} (original color: {})'.format(r, color)) | |
if not 0 <= g <= 5: | |
raise ValueError('Invalid g value: {} (original color: {})'.format(g, color)) | |
if not 0 <= b <= 5: | |
raise ValueError('Invalid b value: {} (original color: {})'.format(b, color)) | |
rgb_to_char = {0: 'a', 1: 'b', 2: 'c', 3: 'd', 4: 'e', 5: 'f'} | |
r = rgb_to_char[r] | |
g = rgb_to_char[g] | |
b = rgb_to_char[b] | |
return "{}{}{}".format(r, g, b) | |
# Prepare the output data | |
output_data = [] | |
# Process each row in the data | |
for _, row in data.iterrows(): | |
output_row = [''] * 6 | |
# Third and sixth columns: bold | |
if row['cterm'] == True: | |
output_row[2] = '<188>' | |
output_row[5] = '(bold)' | |
# First and fourth columns: foreground | |
if pd.notnull(row['ctermfg']): | |
output_row[0] = color256_to_tintin(int(row['ctermfg'])) | |
output_row[0] = '<{}>'.format(output_row[0]) | |
output_row[3] = legend_dict[int(row['ctermfg'])] | |
output_row[3] = 'fg {}'.format(output_row[3]) | |
# Second and fifth columns: background | |
if pd.notnull(row['ctermbg']): | |
output_row[1] = color256_to_tintin(int(row['ctermbg'])) | |
output_row[1] = output_row[1].upper() | |
output_row[1] = '<{}>'.format(output_row[1]) | |
output_row[4] = legend_dict[int(row['ctermbg'])] | |
output_row[4] = 'bg {}'.format(output_row[4]) | |
# Join the first three columns without spaces, and the rest with spaces | |
output_string = '#showme ' | |
output_string += ''.join([x for x in output_row[:3] if x]) | |
output_string += ' '.join([x for x in output_row[3:] if x]) | |
output_string += ';' | |
# Add the output string to the output data | |
output_data.append(output_string) | |
# Print the output data to STDOUT | |
for output_string in output_data: | |
print(output_string) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extracted from https://github.com/tomasr/molokai/blob/master/colors/molokai.vim#L137 | |
import re | |
input_A = """ | |
hi Normal ctermbg=234 | |
hi CursorLine ctermbg=235 cterm=none | |
hi CursorLineNr ctermfg=208 cterm=none | |
hi Boolean ctermfg=135 | |
hi Character ctermfg=144 | |
hi Number ctermfg=135 | |
hi String ctermfg=144 | |
hi Conditional ctermfg=161 cterm=bold | |
hi Constant ctermfg=135 cterm=bold | |
hi Cursor ctermfg=16 ctermbg=253 | |
hi Debug ctermfg=225 cterm=bold | |
hi Define ctermfg=81 | |
hi Delimiter ctermfg=241 | |
hi DiffAdd ctermbg=24 | |
hi DiffChange ctermfg=181 ctermbg=239 | |
hi DiffDelete ctermfg=162 ctermbg=53 | |
hi DiffText ctermbg=102 cterm=bold | |
hi Directory ctermfg=118 cterm=bold | |
hi Error ctermfg=219 ctermbg=89 | |
hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold | |
hi Exception ctermfg=118 cterm=bold | |
hi Float ctermfg=135 | |
hi FoldColumn ctermfg=67 ctermbg=16 | |
hi Folded ctermfg=67 ctermbg=16 | |
hi Function ctermfg=118 | |
hi Identifier ctermfg=208 cterm=none | |
hi Ignore ctermfg=244 ctermbg=232 | |
hi IncSearch ctermfg=193 ctermbg=16 | |
hi keyword ctermfg=161 cterm=bold | |
hi Label ctermfg=229 cterm=none | |
hi Macro ctermfg=193 | |
hi SpecialKey ctermfg=81 | |
hi MatchParen ctermfg=233 ctermbg=208 cterm=bold | |
hi ModeMsg ctermfg=229 | |
hi MoreMsg ctermfg=229 | |
hi Operator ctermfg=161 | |
hi Pmenu ctermfg=81 ctermbg=16 | |
hi PmenuSel ctermfg=255 ctermbg=242 | |
hi PmenuSbar ctermbg=232 | |
hi PmenuThumb ctermfg=81 | |
hi PreCondit ctermfg=118 cterm=bold | |
hi PreProc ctermfg=118 | |
hi Question ctermfg=81 | |
hi Repeat ctermfg=161 cterm=bold | |
hi Search ctermfg=0 ctermbg=222 cterm=NONE | |
hi SignColumn ctermfg=118 ctermbg=235 | |
hi SpecialChar ctermfg=161 cterm=bold | |
hi SpecialComment ctermfg=245 cterm=bold | |
hi Special ctermfg=81 | |
hi SpellBad ctermbg=52 | |
hi SpellCap ctermbg=17 | |
hi SpellLocal ctermbg=17 | |
hi SpellRare ctermfg=none ctermbg=none cterm=reverse | |
hi Statement ctermfg=161 cterm=bold | |
hi StatusLine ctermfg=238 ctermbg=253 | |
hi StatusLineNC ctermfg=244 ctermbg=232 | |
hi StorageClass ctermfg=208 | |
hi Structure ctermfg=81 | |
hi Tag ctermfg=161 | |
hi Title ctermfg=166 | |
hi Todo ctermfg=231 ctermbg=232 cterm=bold | |
hi Typedef ctermfg=81 | |
hi Type ctermfg=81 cterm=none | |
hi Underlined ctermfg=244 cterm=underline | |
hi VertSplit ctermfg=244 ctermbg=232 cterm=bold | |
hi VisualNOS ctermbg=238 | |
hi Visual ctermbg=235 | |
hi WarningMsg ctermfg=231 ctermbg=238 cterm=bold | |
hi WildMenu ctermfg=81 ctermbg=16 | |
hi Comment ctermfg=59 | |
hi CursorColumn ctermbg=236 | |
hi ColorColumn ctermbg=236 | |
hi LineNr ctermfg=250 ctermbg=236 | |
hi NonText ctermfg=59 | |
hi SpecialKey ctermfg=59 | |
hi Normal ctermfg=252 ctermbg=234 | |
hi CursorLine ctermbg=236 cterm=none | |
hi CursorLineNr ctermfg=208 cterm=none | |
hi Boolean ctermfg=141 | |
hi Character ctermfg=222 | |
hi Number ctermfg=141 | |
hi String ctermfg=222 | |
hi Conditional ctermfg=197 cterm=bold | |
hi Constant ctermfg=141 cterm=bold | |
hi DiffDelete ctermfg=125 ctermbg=233 | |
hi Directory ctermfg=154 cterm=bold | |
hi Error ctermfg=222 ctermbg=233 | |
hi Exception ctermfg=154 cterm=bold | |
hi Float ctermfg=141 | |
hi Function ctermfg=154 | |
hi Identifier ctermfg=208 | |
hi Keyword ctermfg=197 cterm=bold | |
hi Operator ctermfg=197 | |
hi PreCondit ctermfg=154 cterm=bold | |
hi PreProc ctermfg=154 | |
hi Repeat ctermfg=197 cterm=bold | |
hi Statement ctermfg=197 cterm=bold | |
hi Tag ctermfg=197 | |
hi Title ctermfg=203 | |
hi Visual ctermbg=238 | |
hi Comment ctermfg=244 | |
hi LineNr ctermfg=239 ctermbg=235 | |
hi NonText ctermfg=239 | |
hi SpecialKey ctermfg=239 | |
""" | |
lines = input_A.strip().split('\n') | |
output = "Name,ctermfg,ctermbg,cterm\n" | |
for line in lines: | |
parts = line.split() | |
name = parts[1] | |
ctermfg = re.search(r'ctermfg=(\d+)', line) | |
ctermbg = re.search(r'ctermbg=(\d+)', line) | |
cterm = re.search(r'cterm=(\w+)', line) | |
ctermfg = ctermfg.group(1) if ctermfg else '' | |
ctermbg = ctermbg.group(1) if ctermbg else '' | |
cterm = 'true' if cterm and cterm.group(1) == 'bold' else '' | |
output += f"{name},{ctermfg},{ctermbg},{cterm}\n" | |
print(output) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name | ctermfg | ctermbg | cterm | |
---|---|---|---|---|
Normal | 234 | |||
CursorLine | 235 | |||
CursorLineNr | 208 | |||
Boolean | 135 | |||
Character | 144 | |||
Number | 135 | |||
String | 144 | |||
Conditional | 161 | true | ||
Constant | 135 | true | ||
Cursor | 16 | 253 | ||
Debug | 225 | true | ||
Define | 81 | |||
Delimiter | 241 | |||
DiffAdd | 24 | |||
DiffChange | 181 | 239 | ||
DiffDelete | 162 | 53 | ||
DiffText | 102 | true | ||
Directory | 118 | true | ||
Error | 219 | 89 | ||
ErrorMsg | 199 | 16 | true | |
Exception | 118 | true | ||
Float | 135 | |||
FoldColumn | 67 | 16 | ||
Folded | 67 | 16 | ||
Function | 118 | |||
Identifier | 208 | |||
Ignore | 244 | 232 | ||
IncSearch | 193 | 16 | ||
keyword | 161 | true | ||
Label | 229 | |||
Macro | 193 | |||
SpecialKey | 81 | |||
MatchParen | 233 | 208 | true | |
ModeMsg | 229 | |||
MoreMsg | 229 | |||
Operator | 161 | |||
Pmenu | 81 | 16 | ||
PmenuSel | 255 | 242 | ||
PmenuSbar | 232 | |||
PmenuThumb | 81 | |||
PreCondit | 118 | true | ||
PreProc | 118 | |||
Question | 81 | |||
Repeat | 161 | true | ||
Search | 0 | 222 | ||
SignColumn | 118 | 235 | ||
SpecialChar | 161 | true | ||
SpecialComment | 245 | true | ||
Special | 81 | |||
SpellBad | 52 | |||
SpellCap | 17 | |||
SpellLocal | 17 | |||
SpellRare | ||||
Statement | 161 | true | ||
StatusLine | 238 | 253 | ||
StatusLineNC | 244 | 232 | ||
StorageClass | 208 | |||
Structure | 81 | |||
Tag | 161 | |||
Title | 166 | |||
Todo | 231 | 232 | true | |
Typedef | 81 | |||
Type | 81 | |||
Underlined | 244 | |||
VertSplit | 244 | 232 | true | |
VisualNOS | 238 | |||
Visual | 235 | |||
WarningMsg | 231 | 238 | true | |
WildMenu | 81 | 16 | ||
Comment | 59 | |||
CursorColumn | 236 | |||
ColorColumn | 236 | |||
LineNr | 250 | 236 | ||
NonText | 59 | |||
SpecialKey | 59 | |||
Normal | 252 | 234 | ||
CursorLine | 236 | |||
CursorLineNr | 208 | |||
Boolean | 141 | |||
Character | 222 | |||
Number | 141 | |||
String | 222 | |||
Conditional | 197 | true | ||
Constant | 141 | true | ||
DiffDelete | 125 | 233 | ||
Directory | 154 | true | ||
Error | 222 | 233 | ||
Exception | 154 | true | ||
Float | 141 | |||
Function | 154 | |||
Identifier | 208 | |||
Keyword | 197 | true | ||
Operator | 197 | |||
PreCondit | 154 | true | ||
PreProc | 154 | |||
Repeat | 197 | true | ||
Statement | 197 | true | ||
Tag | 197 | |||
Title | 203 | |||
Visual | 238 | |||
Comment | 244 | |||
LineNr | 239 | 235 | ||
NonText | 239 | |||
SpecialKey | 239 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
I wanted to do a 256 molokai color scheme in tintin++. I had to do some digging to the standard molokai colors reduced to 256, and then converted to the tintin++ color format.
Sources
The
256_color_names.csv
file is sourced from here.The molokai 256 color info is sourced from here.
Steps
python extract.py > molokai.csv
to generate the CSV (although I've providedmolokai.csv
here).python parse.py
to generate the tintin++ commands (although I've providedcolors.tin
here).