diff --git a/src/yartsu/_themes.py b/src/yartsu/_themes.py new file mode 100644 index 0000000..c4e2044 --- /dev/null +++ b/src/yartsu/_themes.py @@ -0,0 +1,218 @@ +THEMES = ( + ( + "cat-mocha", + ( + [198, 208, 245], + [30, 30, 46], + [ + [179, 188, 223], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [86, 89, 112], + ], + [ + [161, 168, 201], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [67, 70, 90], + ], + ), + ), + ( + "cat-macchiato", + ( + [197, 207, 245], + [36, 39, 58], + [ + [179, 188, 223], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [86, 89, 112], + ], + [ + [161, 168, 201], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [67, 70, 90], + ], + ), + ), + ( + "cat-frappe", + ( + [198, 206, 239], + [48, 52, 70], + [ + [179, 188, 223], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [86, 89, 112], + ], + [ + [161, 168, 201], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [67, 70, 90], + ], + ), + ), + ( + "cat-latte", + ( + [76, 79, 105], + [239, 241, 245], + [ + [179, 188, 223], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [86, 89, 112], + ], + [ + [161, 168, 201], + [243, 139, 168], + [166, 227, 161], + [249, 226, 175], + [135, 176, 249], + [245, 194, 231], + [148, 226, 213], + [67, 70, 90], + ], + ), + ), + ( + "dracula", + ( + [248, 248, 242], + [40, 42, 54], + [ + [33, 34, 44], + [255, 85, 85], + [80, 250, 123], + [241, 250, 140], + [189, 147, 249], + [255, 121, 198], + [139, 233, 253], + [248, 248, 242], + ], + [ + [98, 114, 164], + [255, 110, 110], + [105, 255, 148], + [255, 255, 165], + [214, 172, 255], + [255, 146, 223], + [164, 255, 255], + [255, 255, 255], + ], + ), + ), + ( + "gruvbox-dark", + ( + [213, 196, 161], + [40, 40, 40], + [ + [40, 40, 40], + [251, 73, 52], + [184, 187, 38], + [250, 189, 47], + [131, 165, 152], + [211, 134, 155], + [142, 192, 124], + [213, 196, 161], + ], + [ + [102, 92, 84], + [254, 128, 25], + [60, 56, 54], + [80, 73, 69], + [189, 174, 147], + [235, 219, 178], + [214, 93, 14], + [251, 241, 199], + ], + ), + ), + ( + "gruvbox-light", + ( + [80, 73, 69], + [251, 241, 199], + [ + [251, 241, 199], + [157, 0, 6], + [121, 116, 14], + [181, 118, 20], + [7, 102, 120], + [143, 63, 113], + [66, 123, 88], + [80, 73, 69], + ], + [ + [189, 174, 147], + [175, 58, 3], + [235, 219, 178], + [213, 196, 161], + [102, 92, 84], + [60, 56, 54], + [214, 93, 14], + [40, 40, 40], + ], + ), + ), + ( + "nord", + ( + [215, 222, 233], + [46, 52, 64], + [ + [59, 66, 82], + [191, 97, 106], + [163, 190, 140], + [235, 203, 139], + [129, 161, 193], + [180, 142, 173], + [136, 192, 208], + [229, 233, 240], + ], + [ + [76, 86, 106], + [191, 97, 106], + [163, 190, 140], + [235, 203, 139], + [129, 161, 193], + [180, 142, 173], + [143, 188, 187], + [236, 239, 244], + ], + ), + ), +) diff --git a/src/yartsu/cli.py b/src/yartsu/cli.py index 7c605ab..afe9962 100644 --- a/src/yartsu/cli.py +++ b/src/yartsu/cli.py @@ -6,13 +6,13 @@ from pathlib import Path from rich.__main__ import make_test_card from rich.text import Text +from ._argparse import ArgumentParser from ._export_format import CONSOLE_SVG_FORMAT from ._run_cmd import run_cmd from ._version import __version__ -from .argparse import ArgumentParser from .console import Console from .term import term -from .themes import ThemeDB +from .theme import ThemeDB themes = ThemeDB() diff --git a/src/yartsu/themes.py b/src/yartsu/theme.py similarity index 87% rename from src/yartsu/themes.py rename to src/yartsu/theme.py index f018b22..debb993 100644 --- a/src/yartsu/themes.py +++ b/src/yartsu/theme.py @@ -2,7 +2,6 @@ import json import os import platform import sys -from importlib.resources import files from pathlib import Path from rich import box @@ -16,6 +15,7 @@ from rich.terminal_theme import ( TerminalTheme, ) +from ._themes import THEMES from .term import term @@ -26,7 +26,6 @@ class YartsuTheme(TerminalTheme): @classmethod def load_theme(cls, themepath: Path, src: str): - # theme_file = files("yartsu") / "themes" / f"{name}.json" name = themepath.stem with themepath.open("r") as f: @@ -70,10 +69,9 @@ class YartsuTheme(TerminalTheme): class ThemeDB: def __init__(self): - self.default = os.getenv("YARTSU_THEME", "cat-mocha") + self.default = os.getenv("YARTSU_THEME", "cat-frappe") self.selected = self.default self.themes = { - **self._load_user_themes(), **self._load_yartsu_themes(), **{ "dimmed_monokai": DIMMED_MONOKAI, @@ -96,14 +94,7 @@ class ThemeDB: return theme_dir def _load_yartsu_themes(self): - return { - themepath.stem: YartsuTheme.load_theme(themepath, src="yartsu") - for themepath in sorted( - resource - for resource in (files("yartsu") / "themes").iterdir() - if resource.is_file() - ) - } + return {name: YartsuTheme(*colors, src="yartsu") for name, colors in THEMES} def _load_user_themes(self): if (themes_dir := self._user_themes_location()).is_dir(): diff --git a/src/yartsu/themes/cat-frappe.json b/src/yartsu/themes/cat-frappe.json deleted file mode 100644 index 0943ba7..0000000 --- a/src/yartsu/themes/cat-frappe.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "cat-frappe", "format": "rgb", "foreground": [198, 206, 239], "background": [48, 52, 70], "colors": [[179, 188, 223], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [86, 89, 112]], "bright_colors": [[161, 168, 201], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [67, 70, 90]]} diff --git a/src/yartsu/themes/cat-latte.json b/src/yartsu/themes/cat-latte.json deleted file mode 100644 index 4e4d6c1..0000000 --- a/src/yartsu/themes/cat-latte.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "cat-latte", "format": "rgb", "foreground": [76, 79, 105], "background": [239, 241, 245], "colors": [[179, 188, 223], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [86, 89, 112]], "bright_colors": [[161, 168, 201], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [67, 70, 90]]} diff --git a/src/yartsu/themes/cat-macchiato.json b/src/yartsu/themes/cat-macchiato.json deleted file mode 100644 index cd9fe74..0000000 --- a/src/yartsu/themes/cat-macchiato.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "cat-macchiato", "format": "rgb", "foreground": [197, 207, 245], "background": [36, 39, 58], "colors": [[179, 188, 223], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [86, 89, 112]], "bright_colors": [[161, 168, 201], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [67, 70, 90]]} diff --git a/src/yartsu/themes/cat-mocha.json b/src/yartsu/themes/cat-mocha.json deleted file mode 100644 index 6b745f2..0000000 --- a/src/yartsu/themes/cat-mocha.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "cat-mocha", "format": "rgb", "foreground": [198, 208, 245], "background": [30, 30, 46], "colors": [[179, 188, 223], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [86, 89, 112]], "bright_colors": [[161, 168, 201], [243, 139, 168], [166, 227, 161], [249, 226, 175], [135, 176, 249], [245, 194, 231], [148, 226, 213], [67, 70, 90]]} diff --git a/src/yartsu/themes/dracula.json b/src/yartsu/themes/dracula.json deleted file mode 100644 index 87cb9f4..0000000 --- a/src/yartsu/themes/dracula.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "dracula", "format": "rgb", "foreground": [248, 248, 242], "background": [40, 42, 54], "colors": [[33, 34, 44], [255, 85, 85], [80, 250, 123], [241, 250, 140], [189, 147, 249], [255, 121, 198], [139, 233, 253], [248, 248, 242]], "bright_colors": [[98, 114, 164], [255, 110, 110], [105, 255, 148], [255, 255, 165], [214, 172, 255], [255, 146, 223], [164, 255, 255], [255, 255, 255]]} diff --git a/src/yartsu/themes/gruvbox-dark.json b/src/yartsu/themes/gruvbox-dark.json deleted file mode 100644 index a10caa4..0000000 --- a/src/yartsu/themes/gruvbox-dark.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "gruvbox-dark", "format": "rgb", "foreground": [213, 196, 161], "background": [40, 40, 40], "colors": [[40, 40, 40], [251, 73, 52], [184, 187, 38], [250, 189, 47], [131, 165, 152], [211, 134, 155], [142, 192, 124], [213, 196, 161]], "bright_colors": [[102, 92, 84], [254, 128, 25], [60, 56, 54], [80, 73, 69], [189, 174, 147], [235, 219, 178], [214, 93, 14], [251, 241, 199]]} diff --git a/src/yartsu/themes/gruvbox-light.json b/src/yartsu/themes/gruvbox-light.json deleted file mode 100644 index cf6c013..0000000 --- a/src/yartsu/themes/gruvbox-light.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "gruvbox-light", "format": "rgb", "foreground": [80, 73, 69], "background": [251, 241, 199], "colors": [[251, 241, 199], [157, 0, 6], [121, 116, 14], [181, 118, 20], [7, 102, 120], [143, 63, 113], [66, 123, 88], [80, 73, 69]], "bright_colors": [[189, 174, 147], [175, 58, 3], [235, 219, 178], [213, 196, 161], [102, 92, 84], [60, 56, 54], [214, 93, 14], [40, 40, 40]]} diff --git a/src/yartsu/themes/nord.json b/src/yartsu/themes/nord.json deleted file mode 100644 index e1741a3..0000000 --- a/src/yartsu/themes/nord.json +++ /dev/null @@ -1 +0,0 @@ -{"name": "nord", "format": "rgb", "foreground": [216, 222, 233], "background": [46, 52, 64], "colors": [[59, 66, 82], [191, 97, 106], [163, 190, 140], [235, 203, 139], [129, 161, 193], [180, 142, 173], [136, 192, 208], [229, 233, 240]], "bright_colors": [[76, 86, 106], [191, 97, 106], [163, 190, 140], [235, 203, 139], [129, 161, 193], [180, 142, 173], [143, 188, 187], [236, 239, 244]]}