Add Kitty config
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
fish/local.fish
|
fish/local.fish
|
||||||
|
xonsh/local.xsh
|
||||||
fish/fish_variables
|
fish/fish_variables
|
||||||
lein/repl-history
|
lein/repl-history
|
||||||
lein/self-installs
|
lein/self-installs
|
||||||
|
|||||||
1
deploy.py
Normal file → Executable file
1
deploy.py
Normal file → Executable file
@@ -21,6 +21,7 @@ simple = [
|
|||||||
targeted = {
|
targeted = {
|
||||||
"doom": ".doom.d",
|
"doom": ".doom.d",
|
||||||
"fish": ".config/fish",
|
"fish": ".config/fish",
|
||||||
|
"kitty": ".config/kitty",
|
||||||
"alacritty": ".config/alacritty",
|
"alacritty": ".config/alacritty",
|
||||||
"i3": ".config/i3",
|
"i3": ".config/i3",
|
||||||
"compton.conf": ".config/compton.conf",
|
"compton.conf": ".config/compton.conf",
|
||||||
|
|||||||
1
kitty/.gitignore
vendored
Normal file
1
kitty/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
alt-themes
|
||||||
1345
kitty/kitty.conf
Normal file
1345
kitty/kitty.conf
Normal file
File diff suppressed because it is too large
Load Diff
21
kitty/themes/Alucard.conf
Normal file
21
kitty/themes/Alucard.conf
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
background #222222
|
||||||
|
foreground #cef3ff
|
||||||
|
cursor #ffffff
|
||||||
|
selection_background #44475a
|
||||||
|
color0 #000000
|
||||||
|
color8 #545454
|
||||||
|
color1 #ff5555
|
||||||
|
color9 #ff5454
|
||||||
|
color2 #fa0074
|
||||||
|
color10 #50fa7b
|
||||||
|
color3 #7f0a1f
|
||||||
|
color11 #f0fa8b
|
||||||
|
color4 #3282ff
|
||||||
|
color12 #1200f8
|
||||||
|
color5 #1b3cff
|
||||||
|
color13 #ff78c5
|
||||||
|
color6 #0037fc
|
||||||
|
color14 #8ae9fc
|
||||||
|
color7 #bbbbbb
|
||||||
|
color15 #ffffff
|
||||||
|
selection_foreground #222330
|
||||||
87
powerline/kitty_theme.py
Normal file
87
powerline/kitty_theme.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
INDENT = 2
|
||||||
|
SPACE = " "
|
||||||
|
NEWLINE = "\n"
|
||||||
|
|
||||||
|
|
||||||
|
def to_json(o, level=0):
|
||||||
|
ret = ""
|
||||||
|
if isinstance(o, dict):
|
||||||
|
ret += "{" + NEWLINE
|
||||||
|
comma = ""
|
||||||
|
for k, v in o.items():
|
||||||
|
ret += comma
|
||||||
|
comma = ",\n"
|
||||||
|
ret += SPACE * INDENT * (level+1)
|
||||||
|
ret += '"' + str(k) + '":' + SPACE
|
||||||
|
ret += to_json(v, level + 1)
|
||||||
|
|
||||||
|
ret += NEWLINE + SPACE * INDENT * level + "}"
|
||||||
|
elif isinstance(o, str):
|
||||||
|
ret += '"' + o + '"'
|
||||||
|
elif isinstance(o, list):
|
||||||
|
ret += "[" + ",".join([to_json(e, level+1) for e in o]) + "]"
|
||||||
|
elif isinstance(o, bool):
|
||||||
|
ret += "true" if o else "false"
|
||||||
|
elif isinstance(o, int):
|
||||||
|
ret += str(o)
|
||||||
|
elif isinstance(o, float):
|
||||||
|
ret += '%.7g' % o
|
||||||
|
elif o is None:
|
||||||
|
ret += 'null'
|
||||||
|
else:
|
||||||
|
raise TypeError("Unknown type '%s' for json serialization" % str(type(o)))
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def cterm(cname: str) -> int:
|
||||||
|
if cname == "background":
|
||||||
|
return 0
|
||||||
|
if cname == "foreground":
|
||||||
|
return 15
|
||||||
|
if cname == "selection_background":
|
||||||
|
return 2
|
||||||
|
if cname == "selection_foreground":
|
||||||
|
return 15
|
||||||
|
if cname == "cursor":
|
||||||
|
return 2
|
||||||
|
|
||||||
|
if "color" in cname:
|
||||||
|
return int(cname.strip("color"))
|
||||||
|
|
||||||
|
|
||||||
|
def parse_kitty_theme(name: str, theme: str) -> dict:
|
||||||
|
d = {}
|
||||||
|
|
||||||
|
for line in theme.splitlines():
|
||||||
|
colorname, colorhex = line.split()
|
||||||
|
d[f"kitty:{colorname}"] = [cterm(colorname), colorhex[1:]]
|
||||||
|
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
def get_kitty_theme() -> Path:
|
||||||
|
kitty_conf = Path.home() / ".config" / "kitty" / "kitty.conf"
|
||||||
|
txt = kitty_conf.read_text()
|
||||||
|
match = re.search(r"include (\./themes/.*.conf)", txt)
|
||||||
|
theme_name = match.groups()[0]
|
||||||
|
print("theme_name: ", theme_name)
|
||||||
|
theme_path = kitty_conf.parent / theme_name
|
||||||
|
print("theme_path: ", theme_path)
|
||||||
|
return theme_path
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
f = get_kitty_theme()
|
||||||
|
colors_file = Path(__file__).parent / "colors.json"
|
||||||
|
powerline_colors = json.loads(colors_file.read_text())
|
||||||
|
|
||||||
|
kitty_colors = parse_kitty_theme(f.stem, f.read_text())
|
||||||
|
powerline_colors["colors"].update(kitty_colors)
|
||||||
|
colors_file.write_text(to_json(powerline_colors))
|
||||||
Reference in New Issue
Block a user