[alacritty] Fix some color stuff
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.swp
|
||||
tags
|
||||
.DS_STORE
|
||||
__pycache__
|
||||
|
||||
Reference in New Issue
Block a user