Created
May 28, 2020 19:06
-
-
Save Riatre/a7d0e3cc9f76e156111a30c509b70143 to your computer and use it in GitHub Desktop.
This file contains 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 sys, re, json | |
COLOR_NAME = [ | |
"foreground", | |
"// Default Bold Foreground", | |
"background", | |
"// Default Bold Background", | |
"// Cursor Text", | |
"cursorColor", | |
"black", | |
"brightBlack", | |
"red", | |
"brightRed", | |
"green", | |
"brightGreen", | |
"yellow", | |
"brightYellow", | |
"blue", | |
"brightBlue", | |
"purple", | |
"brightPurple", | |
"cyan", | |
"brightCyan", | |
"white", | |
"brightWhite", | |
"// Cursor Text (IME ON)", | |
"// Cursor Colour (IME ON)", | |
] | |
scheme = { | |
"name": "Converted From putty.ini", | |
} | |
for line in sys.stdin.readlines(): | |
m = re.match(r'Colour(\d+)="(\d+),(\d+),(\d+)"', line.strip()) | |
if m: | |
idx, r, g, b = map(int, m.groups()) | |
scheme[COLOR_NAME[idx]] = "#{:02X}{:02X}{:02X}".format(r, g, b) | |
print(json.dumps(scheme, indent=2).replace('"// ', '// "')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment