[alacritty] Fix some color stuff

This commit is contained in:
Fabian Ising
2023-09-18 10:26:30 +02:00
parent bb76a182df
commit 2303f6f7f3
3 changed files with 17 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
import os
import re
import sys
SCHEME_FILE_NAME = "schemes.yml"
CONFIG_FILE_DIR = os.path.expanduser("~/.config/alacritty/")
@@ -17,7 +18,7 @@ NVIM_CONFIG_FILE_PATH = os.path.join(NVIM_CONFIG_FILE_DIR, NVIM_CONFIG_FILE_NAME
NVIM_COLOR_SCHEME_LINE_SEARCH = "set background=(\S+)\ncolorscheme (\S+)"
NVIM_COLOR_SCHEME_LINE_TEMPLATE = "set background={}\ncolorscheme {}"
def change_alacritty_theme():
def change_alacritty_theme(light_mode=None):
with open(SCHEME_FILE_PATH, "r") as scheme_file:
scheme_file.seek(0)
lines = scheme_file.readlines()
@@ -29,7 +30,12 @@ def change_alacritty_theme():
current_color_scheme = match.group(1)
colors_line_index = i
if current_color_scheme == "dark_mode":
if light_mode is None:
if current_color_scheme == "dark_mode":
new_scheme = "solarized_light"
else:
new_scheme = "dark_mode"
elif light_mode == True:
new_scheme = "solarized_light"
else:
new_scheme = "dark_mode"
@@ -55,10 +61,13 @@ def change_vim_theme(light_mode=False):
config = config_file.write(res)
def main():
new_theme = change_alacritty_theme()
def main(light_mode=None):
new_theme = change_alacritty_theme(light_mode)
change_vim_theme(new_theme == "solarized_light")
if __name__=="__main__":
main()
if len(sys.argv) == 2:
main(sys.argv == "light")
else:
main()

View File

@@ -10,6 +10,7 @@
"""
import os
import sys
import color_switcher
CONFIG_FILE_NAME = "alacritty.yml"
CONFIG_FILE_DIR = os.path.expanduser("~/.config/alacritty/")
@@ -37,4 +38,4 @@ def main(turn_on=False):
if __name__=="__main__":
main(len(sys.argv) == 2 and sys.argv[1] == "on")
color_switcher.main(len(sys.argv) == 2 and sys.argv[1] == "on")