Skip to content

Instantly share code, notes, and snippets.

@winterjung
Created June 22, 2019 07:02
Show Gist options
  • Save winterjung/a7c3c3376acbc6e4425f540f43596db8 to your computer and use it in GitHub Desktop.
Save winterjung/a7c3c3376acbc6e4425f540f43596db8 to your computer and use it in GitHub Desktop.
Configure dracula color scheme on WSL Ubuntu
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\C:_Program Files_WindowsApps_CanonicalGroupLimited.Ubuntu18.04onWindows_1804.2019.522.0_x64__79rhkp1fndgsc_ubuntu1804.exe]
"ColorTable00"=dword:00352826
"ColorTable01"=dword:00f892bc
"ColorTable02"=dword:007bf94f
"ColorTable03"=dword:00a47261
"ColorTable04"=dword:005454ff
"ColorTable05"=dword:00c579ff
"ColorTable06"=dword:006cb7ff
"ColorTable07"=dword:00f1f7f7
"ColorTable08"=dword:00545454
"ColorTable09"=dword:00f892bc
"ColorTable10"=dword:007bf94f
"ColorTable11"=dword:00fce88a
"ColorTable12"=dword:005454ff
"ColorTable13"=dword:00c579ff
"ColorTable14"=dword:008bf9f0
"ColorTable15"=dword:00ffffff
from typing import Tuple
COLORS = """
38 40 53
188 146 248
79 249 123
97 114 164
255 84 84
255 121 197
255 183 108
247 247 241
84 84 84
188 146 248
79 249 123
138 232 252
255 84 84
255 121 197
240 249 139
255 255 255
"""
def pre_process(line: str) -> Tuple[int, int, int]:
return tuple(map(int, line.split(' ')))
def convert(r: int, g: int, b: int) -> Tuple[str, str, str]:
def _format(n: int) -> str:
return hex(n).replace('0x', '')
return tuple(_format(n) for n in (r, g, b))
def combine(hex_colors: Tuple[str, str, str]) -> str:
return ''.join(reversed(hex_colors))
def formatting(hex_color: str) -> str:
return f'dword:00{hex_color}'
def process(line: str) -> str:
return formatting(combine(convert(*pre_process(line))))
def check():
assert process('38 40 53') == 'dword:00352826'
assert process('188 146 248') == 'dword:00f892bc'
def print_converted_table(table: str) -> None:
for i, line in enumerate(table.strip().split('\n')):
print(f'"ColorTable{str(i).zfill(2)}"={process(line)}')
def main():
check()
print_converted_table(COLORS)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment