add stuff

This commit is contained in:
2026-02-16 20:00:12 +01:00
parent 2fb3eb1f52
commit 0a4ff4c504
25 changed files with 2633 additions and 186 deletions

View File

@ -0,0 +1,39 @@
#!/usr/bin/env python3
import re
from argparse import ArgumentParser
from pathlib import Path
if __name__ == "__main__":
parser = ArgumentParser(description="VS Code theme switcher")
parser.add_argument(
"mode",
help="The mode to switch the VS Code theme to (e.g., 'dark' or 'light')",
)
args = parser.parse_args()
if args.mode not in ["dark", "light"]:
print("Invalid mode. Please choose 'dark' or 'light'.")
exit(1)
settings = Path.home() / ".config/Code/User/settings.json"
if not settings.exists():
print(f"VS Code settings file not found at {settings}")
exit(1)
# We just replace the theme name in the settings file using regex,
# this way we don't have to worry about jsonc parsing.
theme = "Monokai Pro" if args.mode == "dark" else "Monokai Pro Light"
with settings.open("r") as f:
content = f.read()
new_content = re.sub(
r'"workbench\.colorTheme"\s*:\s*".*?"',
f'"workbench.colorTheme": "{theme}"',
content,
)
with settings.open("w") as f:
f.write(new_content)