From b27361b4258c993ff394a9d3d1820b6b71b910e8 Mon Sep 17 00:00:00 2001 From: python357-1 Date: Mon, 2 Dec 2024 03:03:31 -0600 Subject: [PATCH 1/5] feat: user defined colors --- tagstudio/src/core/library/alchemy/db.py | 55 ++++++++++++++++++++ tagstudio/src/core/library/alchemy/models.py | 8 +++ 2 files changed, 63 insertions(+) diff --git a/tagstudio/src/core/library/alchemy/db.py b/tagstudio/src/core/library/alchemy/db.py index f1a23f5d3..feea610bd 100644 --- a/tagstudio/src/core/library/alchemy/db.py +++ b/tagstudio/src/core/library/alchemy/db.py @@ -40,6 +40,61 @@ def make_tables(engine: Engine) -> None: with engine.connect() as conn: conn.execute(text("INSERT INTO tags (id, name, color) VALUES (999, 'temp', 1)")) conn.execute(text("DELETE FROM tags WHERE id = 999")) + + conn.execute( + text( + """INSERT INTO user_defined_colors (color, name, user_defined) VALUES + ('#1e1e1e', 'DEFAULT', TRUE), + ('#111018', 'BLACK', TRUE), + ('#24232a', 'DARK_GRAY', TRUE), + ('#53525a', 'GRAY', TRUE), + ('#aaa9b0', 'LIGHT_GRAY', TRUE), + ('#f2f1f8', 'WHITE', TRUE), + ('#ff99c4', 'LIGHT_PINK', TRUE), + ('#ff99c4', 'PINK', TRUE), + ('#f6466f', 'MAGENTA', TRUE), + ('#e22c3c', 'RED', TRUE), + ('#e83726', 'RED_ORANGE', TRUE), + ('#f65848', 'SALMON', TRUE), + ('#ed6022', 'ORANGE', TRUE), + ('#fa9a2c', 'YELLOW_ORANGE', TRUE), + ('#ffd63d', 'YELLOW', TRUE), + ('#4aed90', 'MINT', TRUE), + ('#92e649', 'LIME', TRUE), + ('#85ec76', 'LIGHT_GREEN', TRUE), + ('#28bb48', 'GREEN', TRUE), + ('#1ad9b2', 'TEAL', TRUE), + ('#49e4d5', 'CYAN', TRUE), + ('#55bbf6', 'LIGHT_BLUE', TRUE), + ('#3b87f0', 'BLUE', TRUE), + ('#5948f2', 'BLUE_VIOLET', TRUE), + ('#874ff5', 'VIOLET', TRUE), + ('#bb4ff0', 'PURPLE', TRUE), + ('#f1c69c', 'PEACH', TRUE), + ('#823216', 'BROWN', TRUE), + ('#ad8eef', 'LAVENDER', TRUE), + ('#efc664', 'BLONDE', TRUE), + ('#a13220', 'AUBURN', TRUE), + ('#be5b2d', 'LIGHT_BROWN', TRUE), + ('#4c2315', 'DARK_BROWN', TRUE), + ('#515768', 'COOL_GRAY', TRUE), + ('#625550', 'WARM_GRAY', TRUE), + ('#4c652e', 'OLIVE', TRUE), + ('#9f2aa7', 'BERRY', TRUE)""" + ) + ) + + conn.execute( + text( + """ + CREATE TRIGGER delete_color BEFORE DELETE ON user_defined_colors + WHEN OLD.user_defined = FALSE + BEGIN + SELECT RAISE(ABORT, 'Cannot delete program-defined colors'); + END; + """ + ) + ) conn.commit() diff --git a/tagstudio/src/core/library/alchemy/models.py b/tagstudio/src/core/library/alchemy/models.py index 8da0c4708..7fe41780e 100644 --- a/tagstudio/src/core/library/alchemy/models.py +++ b/tagstudio/src/core/library/alchemy/models.py @@ -212,6 +212,14 @@ def remove_tag(self, tag: Tag, field: TagBoxField | None = None) -> None: tag_box_field.tags.remove(tag) +class UserDefinedColor(Base): + __tablename__ = "user_defined_colors" + id: Mapped[int] = mapped_column(primary=True) + color: Mapped[str] = mapped_column(unique=True) + name: Mapped[str] = mapped_column() + user_defined: Mapped[bool] = mapped_column(default=True) + + class ValueType(Base): """Define Field Types in the Library. From fd52f565cea9c629595857529f0c4cf5e5b446e2 Mon Sep 17 00:00:00 2001 From: python357-1 Date: Mon, 2 Dec 2024 12:38:12 -0600 Subject: [PATCH 2/5] fix: bools were wrong --- tagstudio/src/core/library/alchemy/db.py | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/tagstudio/src/core/library/alchemy/db.py b/tagstudio/src/core/library/alchemy/db.py index feea610bd..860795b1e 100644 --- a/tagstudio/src/core/library/alchemy/db.py +++ b/tagstudio/src/core/library/alchemy/db.py @@ -44,43 +44,43 @@ def make_tables(engine: Engine) -> None: conn.execute( text( """INSERT INTO user_defined_colors (color, name, user_defined) VALUES - ('#1e1e1e', 'DEFAULT', TRUE), - ('#111018', 'BLACK', TRUE), - ('#24232a', 'DARK_GRAY', TRUE), - ('#53525a', 'GRAY', TRUE), - ('#aaa9b0', 'LIGHT_GRAY', TRUE), - ('#f2f1f8', 'WHITE', TRUE), - ('#ff99c4', 'LIGHT_PINK', TRUE), - ('#ff99c4', 'PINK', TRUE), - ('#f6466f', 'MAGENTA', TRUE), - ('#e22c3c', 'RED', TRUE), - ('#e83726', 'RED_ORANGE', TRUE), - ('#f65848', 'SALMON', TRUE), - ('#ed6022', 'ORANGE', TRUE), - ('#fa9a2c', 'YELLOW_ORANGE', TRUE), - ('#ffd63d', 'YELLOW', TRUE), - ('#4aed90', 'MINT', TRUE), - ('#92e649', 'LIME', TRUE), - ('#85ec76', 'LIGHT_GREEN', TRUE), - ('#28bb48', 'GREEN', TRUE), - ('#1ad9b2', 'TEAL', TRUE), - ('#49e4d5', 'CYAN', TRUE), - ('#55bbf6', 'LIGHT_BLUE', TRUE), - ('#3b87f0', 'BLUE', TRUE), - ('#5948f2', 'BLUE_VIOLET', TRUE), - ('#874ff5', 'VIOLET', TRUE), - ('#bb4ff0', 'PURPLE', TRUE), - ('#f1c69c', 'PEACH', TRUE), - ('#823216', 'BROWN', TRUE), - ('#ad8eef', 'LAVENDER', TRUE), - ('#efc664', 'BLONDE', TRUE), - ('#a13220', 'AUBURN', TRUE), - ('#be5b2d', 'LIGHT_BROWN', TRUE), - ('#4c2315', 'DARK_BROWN', TRUE), - ('#515768', 'COOL_GRAY', TRUE), - ('#625550', 'WARM_GRAY', TRUE), - ('#4c652e', 'OLIVE', TRUE), - ('#9f2aa7', 'BERRY', TRUE)""" + ('#1e1e1e', 'DEFAULT', FALSE), + ('#111018', 'BLACK', FALSE), + ('#24232a', 'DARK_GRAY', FALSE), + ('#53525a', 'GRAY', FALSE), + ('#aaa9b0', 'LIGHT_GRAY', FALSE), + ('#f2f1f8', 'WHITE', FALSE), + ('#ff99c4', 'LIGHT_PINK', FALSE), + ('#ff99c4', 'PINK', FALSE), + ('#f6466f', 'MAGENTA', FALSE), + ('#e22c3c', 'RED', FALSE), + ('#e83726', 'RED_ORANGE', FALSE), + ('#f65848', 'SALMON', FALSE), + ('#ed6022', 'ORANGE', FALSE), + ('#fa9a2c', 'YELLOW_ORANGE', FALSE), + ('#ffd63d', 'YELLOW', FALSE), + ('#4aed90', 'MINT', FALSE), + ('#92e649', 'LIME', FALSE), + ('#85ec76', 'LIGHT_GREEN', FALSE), + ('#28bb48', 'GREEN', FALSE), + ('#1ad9b2', 'TEAL', FALSE), + ('#49e4d5', 'CYAN', FALSE), + ('#55bbf6', 'LIGHT_BLUE', FALSE), + ('#3b87f0', 'BLUE', FALSE), + ('#5948f2', 'BLUE_VIOLET', FALSE), + ('#874ff5', 'VIOLET', FALSE), + ('#bb4ff0', 'PURPLE', FALSE), + ('#f1c69c', 'PEACH', FALSE), + ('#823216', 'BROWN', FALSE), + ('#ad8eef', 'LAVENDER', FALSE), + ('#efc664', 'BLONDE', FALSE), + ('#a13220', 'AUBURN', FALSE), + ('#be5b2d', 'LIGHT_BROWN', FALSE), + ('#4c2315', 'DARK_BROWN', FALSE), + ('#515768', 'COOL_GRAY', FALSE), + ('#625550', 'WARM_GRAY', FALSE), + ('#4c652e', 'OLIVE', FALSE), + ('#9f2aa7', 'BERRY', FALSE)""" ) ) From 1213d181143aaf8da8b93ca02b31a558b5d94048 Mon Sep 17 00:00:00 2001 From: python357-1 Date: Tue, 3 Dec 2024 23:32:25 -0600 Subject: [PATCH 3/5] add basic color models with color namespaces --- tagstudio/src/core/utils/color.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tagstudio/src/core/utils/color.py diff --git a/tagstudio/src/core/utils/color.py b/tagstudio/src/core/utils/color.py new file mode 100644 index 000000000..e69de29bb From da9730b6495a968320a236ec3b6c9413fa01a422 Mon Sep 17 00:00:00 2001 From: python357-1 Date: Tue, 3 Dec 2024 23:43:27 -0600 Subject: [PATCH 4/5] add basic color models with color namespaces --- tagstudio/src/core/library/alchemy/db.py | 45 +- tagstudio/src/core/library/alchemy/enums.py | 20 +- tagstudio/src/core/library/alchemy/library.py | 69 +- tagstudio/src/core/library/alchemy/models.py | 20 +- tagstudio/src/core/palette.py | 680 +++++++++--------- tagstudio/src/core/utils/color.py | 15 + 6 files changed, 453 insertions(+), 396 deletions(-) diff --git a/tagstudio/src/core/library/alchemy/db.py b/tagstudio/src/core/library/alchemy/db.py index 860795b1e..e28d78a56 100644 --- a/tagstudio/src/core/library/alchemy/db.py +++ b/tagstudio/src/core/library/alchemy/db.py @@ -41,53 +41,10 @@ def make_tables(engine: Engine) -> None: conn.execute(text("INSERT INTO tags (id, name, color) VALUES (999, 'temp', 1)")) conn.execute(text("DELETE FROM tags WHERE id = 999")) - conn.execute( - text( - """INSERT INTO user_defined_colors (color, name, user_defined) VALUES - ('#1e1e1e', 'DEFAULT', FALSE), - ('#111018', 'BLACK', FALSE), - ('#24232a', 'DARK_GRAY', FALSE), - ('#53525a', 'GRAY', FALSE), - ('#aaa9b0', 'LIGHT_GRAY', FALSE), - ('#f2f1f8', 'WHITE', FALSE), - ('#ff99c4', 'LIGHT_PINK', FALSE), - ('#ff99c4', 'PINK', FALSE), - ('#f6466f', 'MAGENTA', FALSE), - ('#e22c3c', 'RED', FALSE), - ('#e83726', 'RED_ORANGE', FALSE), - ('#f65848', 'SALMON', FALSE), - ('#ed6022', 'ORANGE', FALSE), - ('#fa9a2c', 'YELLOW_ORANGE', FALSE), - ('#ffd63d', 'YELLOW', FALSE), - ('#4aed90', 'MINT', FALSE), - ('#92e649', 'LIME', FALSE), - ('#85ec76', 'LIGHT_GREEN', FALSE), - ('#28bb48', 'GREEN', FALSE), - ('#1ad9b2', 'TEAL', FALSE), - ('#49e4d5', 'CYAN', FALSE), - ('#55bbf6', 'LIGHT_BLUE', FALSE), - ('#3b87f0', 'BLUE', FALSE), - ('#5948f2', 'BLUE_VIOLET', FALSE), - ('#874ff5', 'VIOLET', FALSE), - ('#bb4ff0', 'PURPLE', FALSE), - ('#f1c69c', 'PEACH', FALSE), - ('#823216', 'BROWN', FALSE), - ('#ad8eef', 'LAVENDER', FALSE), - ('#efc664', 'BLONDE', FALSE), - ('#a13220', 'AUBURN', FALSE), - ('#be5b2d', 'LIGHT_BROWN', FALSE), - ('#4c2315', 'DARK_BROWN', FALSE), - ('#515768', 'COOL_GRAY', FALSE), - ('#625550', 'WARM_GRAY', FALSE), - ('#4c652e', 'OLIVE', FALSE), - ('#9f2aa7', 'BERRY', FALSE)""" - ) - ) - conn.execute( text( """ - CREATE TRIGGER delete_color BEFORE DELETE ON user_defined_colors + CREATE TRIGGER IF NOT EXISTS delete_color BEFORE DELETE ON colors WHEN OLD.user_defined = FALSE BEGIN SELECT RAISE(ABORT, 'Cannot delete program-defined colors'); diff --git a/tagstudio/src/core/library/alchemy/enums.py b/tagstudio/src/core/library/alchemy/enums.py index 7c70f92e6..08cf09dcb 100644 --- a/tagstudio/src/core/library/alchemy/enums.py +++ b/tagstudio/src/core/library/alchemy/enums.py @@ -3,6 +3,7 @@ from pathlib import Path +# TODO: REMOVE class TagColor(enum.IntEnum): DEFAULT = 1 BLACK = 2 @@ -42,12 +43,19 @@ class TagColor(enum.IntEnum): COOL_GRAY = 36 OLIVE = 37 - @staticmethod - def get_color_from_str(color_name: str) -> "TagColor": - for color in TagColor: - if color.name == color_name.upper().replace(" ", "_"): - return color - return TagColor.DEFAULT +#class TSStandardColors(enum.IntEnum): +# RED=1, +# YELLOW=2, +# CYAN=3, +# BLUE=4 +# #etc.. + +# @staticmethod +# def get_color_from_str(color_name: str) -> "TagColor": +# for color in TagColor: +# if color.name == color_name.upper().replace(" ", "_"): +# return color +# return TagColor.DEFAULT class SearchMode(enum.IntEnum): diff --git a/tagstudio/src/core/library/alchemy/library.py b/tagstudio/src/core/library/alchemy/library.py index 16d5f9c3c..f99a5db20 100644 --- a/tagstudio/src/core/library/alchemy/library.py +++ b/tagstudio/src/core/library/alchemy/library.py @@ -52,7 +52,7 @@ _FieldID, ) from .joins import TagField, TagSubtag -from .models import Entry, Folder, Preferences, Tag, TagAlias, ValueType +from .models import Entry, Folder, Preferences, Tag, TagAlias, ValueType, Color, ColorNamespace logger = structlog.get_logger(__name__) @@ -91,6 +91,51 @@ def get_default_tags() -> tuple[Tag, ...]: return archive_tag, favorite_tag +def get_default_colors(namespace: ColorNamespace) -> list[Color]: + colors: list[Color] = [ + #TODO: reduce this to limited tagstudio standard color set + Color(id=1, hex_value="#1e1e1e", name="Default", user_defined=False, namespace_id=namespace.id), + Color(id=2, hex_value="#111018", name="BLACK", user_defined=False, namespace_id=namespace.id), + Color(id=3, hex_value="#24232a", name="DARK_GRAY", user_defined=False, namespace_id=namespace.id), + Color(id=4, hex_value="#53525a", name="GRAY", user_defined=False, namespace_id=namespace.id), + Color(id=5, hex_value="#aaa9b0", name="LIGHT_GRAY", user_defined=False, namespace_id=namespace.id), + Color(id=6, hex_value="#f2f1f8", name="WHITE", user_defined=False, namespace_id=namespace.id), + Color(id=7, hex_value="#ff99c4", name="LIGHT_PINK", user_defined=False, namespace_id=namespace.id), + Color(id=8, hex_value="#ff99c4", name="PINK", user_defined=False, namespace_id=namespace.id), + Color(id=9, hex_value="#f6466f", name="MAGENTA", user_defined=False, namespace_id=namespace.id), + Color(id=10, hex_value="#e22c3c", name="RED", user_defined=False, namespace_id=namespace.id), + Color(id=11, hex_value="#e83726", name="RED_ORANGE", user_defined=False, namespace_id=namespace.id), + Color(id=12, hex_value="#f65848", name="SALMON", user_defined=False, namespace_id=namespace.id), + Color(id=13, hex_value="#ed6022", name="ORANGE", user_defined=False, namespace_id=namespace.id), + Color(id=14, hex_value="#fa9a2c", name="YELLOW_ORANGE", user_defined=False, namespace_id=namespace.id), + Color(id=15, hex_value="#ffd63d", name="YELLOW", user_defined=False, namespace_id=namespace.id), + Color(id=16, hex_value="#4aed90", name="MINT", user_defined=False, namespace_id=namespace.id), + Color(id=17, hex_value="#92e649", name="LIME", user_defined=False, namespace_id=namespace.id), + Color(id=18, hex_value="#85ec76", name="LIGHT_GREEN", user_defined=False, namespace_id=namespace.id), + Color(id=19, hex_value="#28bb48", name="GREEN", user_defined=False, namespace_id=namespace.id), + Color(id=20, hex_value="#1ad9b2", name="TEAL", user_defined=False, namespace_id=namespace.id), + Color(id=21, hex_value="#49e4d5", name="CYAN", user_defined=False, namespace_id=namespace.id), + Color(id=22, hex_value="#55bbf6", name="LIGHT_BLUE", user_defined=False, namespace_id=namespace.id), + Color(id=23, hex_value="#3b87f0", name="BLUE", user_defined=False, namespace_id=namespace.id), + Color(id=24, hex_value="#5948f2", name="BLUE_VIOLET", user_defined=False, namespace_id=namespace.id), + Color(id=25, hex_value="#874ff5", name="VIOLET", user_defined=False, namespace_id=namespace.id), + Color(id=26, hex_value="#bb4ff0", name="PURPLE", user_defined=False, namespace_id=namespace.id), + Color(id=27, hex_value="#f1c69c", name="PEACH", user_defined=False, namespace_id=namespace.id), + Color(id=28, hex_value="#823216", name="BROWN", user_defined=False, namespace_id=namespace.id), + Color(id=29, hex_value="#ad8eef", name="LAVENDER", user_defined=False, namespace_id=namespace.id), + Color(id=31, hex_value="#efc664", name="BLONDE", user_defined=False, namespace_id=namespace.id), + Color(id=32, hex_value="#a13220", name="AUBURN", user_defined=False, namespace_id=namespace.id), + Color(id=33, hex_value="#be5b2d", name="LIGHT_BROWN", user_defined=False, namespace_id=namespace.id), + Color(id=34, hex_value="#4c2315", name="DARK_BROWN", user_defined=False, namespace_id=namespace.id), + Color(id=35, hex_value="#515768", name="COOL_GRAY", user_defined=False, namespace_id=namespace.id), + Color(id=36, hex_value="#625550", name="WARM_GRAY", user_defined=False, namespace_id=namespace.id), + Color(id=37, hex_value="#4c652e", name="OLIVE", user_defined=False, namespace_id=namespace.id), + Color(id=38, hex_value="#9f2aa7", name="BERRY", user_defined=False, namespace_id=namespace.id), + ] + + return colors + + @dataclass(frozen=True) class SearchResult: """Wrapper for search results. @@ -256,6 +301,7 @@ def open_sqlite_library( if add_default_data: tags = get_default_tags() + try: session.add_all(tags) session.commit() @@ -263,6 +309,27 @@ def open_sqlite_library( # default tags may exist already session.rollback() + #the default namespace shouldnt exist yet but we will check anyway + ts_std_namespace_name = "tagstudio_std" #TODO: move this elsewhere maybe + statement = select(ColorNamespace).where(ColorNamespace.name == ts_std_namespace_name) + ts_std_namespace = session.scalar(statement) + + if ts_std_namespace is None: + ts_std_namespace = ColorNamespace(name=ts_std_namespace_name) + session.add(ts_std_namespace) + session.commit() + + try: + colors = get_default_colors(ts_std_namespace) + session.add_all( + colors + ) + session.commit() + except IntegrityError: + #colors already exist + session.rollback() + + # dont check db version when creating new library if not is_new: db_version = session.scalar( diff --git a/tagstudio/src/core/library/alchemy/models.py b/tagstudio/src/core/library/alchemy/models.py index 7fe41780e..52f2fecbe 100644 --- a/tagstudio/src/core/library/alchemy/models.py +++ b/tagstudio/src/core/library/alchemy/models.py @@ -1,6 +1,6 @@ from pathlib import Path -from sqlalchemy import JSON, ForeignKey, Integer, event +from sqlalchemy import JSON, ForeignKey, Integer, event, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column, relationship from ...constants import TAG_ARCHIVED, TAG_FAVORITE @@ -211,15 +211,23 @@ def remove_tag(self, tag: Tag, field: TagBoxField | None = None) -> None: for tag_box_field in self.tag_box_fields: tag_box_field.tags.remove(tag) +#TODO: maybe make this a general namespace to be used for colors, tags, etc? +class ColorNamespace(Base): + __tablename__ = "color_namespaces" + id: Mapped[int] = mapped_column(primary_key=True) + name: Mapped[str] = mapped_column() + colors: Mapped[list["Color"]] = relationship() + +class Color(Base): + __tablename__ = "colors" -class UserDefinedColor(Base): - __tablename__ = "user_defined_colors" - id: Mapped[int] = mapped_column(primary=True) - color: Mapped[str] = mapped_column(unique=True) + id: Mapped[int] = mapped_column(primary_key=True) + namespace_id: Mapped[int] = mapped_column(ForeignKey("color_namespaces.id"), primary_key = True) + + hex_value: Mapped[str] = mapped_column() name: Mapped[str] = mapped_column() user_defined: Mapped[bool] = mapped_column(default=True) - class ValueType(Base): """Define Field Types in the Library. diff --git a/tagstudio/src/core/palette.py b/tagstudio/src/core/palette.py index 422b35f7c..23855bb16 100644 --- a/tagstudio/src/core/palette.py +++ b/tagstudio/src/core/palette.py @@ -27,346 +27,348 @@ class UiColor(IntEnum): GREEN = 4 PURPLE = 5 +# keeping tag_colors and ui_colors around for future reference during migration to new Color model +# but they should be deleted eventually -TAG_COLORS: dict[TagColor, dict[ColorType, Any]] = { - TagColor.DEFAULT: { - ColorType.PRIMARY: "#1e1e1e", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#333333", - ColorType.LIGHT_ACCENT: "#FFFFFF", - ColorType.DARK_ACCENT: "#222222", - }, - TagColor.BLACK: { - ColorType.PRIMARY: "#111018", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#18171e", - ColorType.LIGHT_ACCENT: "#b7b6be", - ColorType.DARK_ACCENT: "#03020a", - }, - TagColor.DARK_GRAY: { - ColorType.PRIMARY: "#24232a", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#2a2930", - ColorType.LIGHT_ACCENT: "#bdbcc4", - ColorType.DARK_ACCENT: "#07060e", - }, - TagColor.GRAY: { - ColorType.PRIMARY: "#53525a", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#5b5a62", - ColorType.LIGHT_ACCENT: "#cbcad2", - ColorType.DARK_ACCENT: "#191820", - }, - TagColor.LIGHT_GRAY: { - ColorType.PRIMARY: "#aaa9b0", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#b6b4bc", - ColorType.LIGHT_ACCENT: "#cbcad2", - ColorType.DARK_ACCENT: "#191820", - }, - TagColor.WHITE: { - ColorType.PRIMARY: "#f2f1f8", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#fefeff", - ColorType.LIGHT_ACCENT: "#ffffff", - ColorType.DARK_ACCENT: "#302f36", - }, - TagColor.LIGHT_PINK: { - ColorType.PRIMARY: "#ff99c4", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#ffaad0", - ColorType.LIGHT_ACCENT: "#ffcbe7", - ColorType.DARK_ACCENT: "#6c2e3b", - }, - TagColor.PINK: { - ColorType.PRIMARY: "#ff99c4", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#ffaad0", - ColorType.LIGHT_ACCENT: "#ffcbe7", - ColorType.DARK_ACCENT: "#6c2e3b", - }, - TagColor.MAGENTA: { - ColorType.PRIMARY: "#f6466f", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#f7587f", - ColorType.LIGHT_ACCENT: "#fba4bf", - ColorType.DARK_ACCENT: "#61152f", - }, - TagColor.RED: { - ColorType.PRIMARY: "#e22c3c", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#b21f2d", - # ColorType.BORDER: '#e54252', - ColorType.LIGHT_ACCENT: "#f39caa", - ColorType.DARK_ACCENT: "#440d12", - }, - TagColor.RED_ORANGE: { - ColorType.PRIMARY: "#e83726", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#ea4b3b", - ColorType.LIGHT_ACCENT: "#f5a59d", - ColorType.DARK_ACCENT: "#61120b", - }, - TagColor.SALMON: { - ColorType.PRIMARY: "#f65848", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#f76c5f", - ColorType.LIGHT_ACCENT: "#fcadaa", - ColorType.DARK_ACCENT: "#6f1b16", - }, - TagColor.ORANGE: { - ColorType.PRIMARY: "#ed6022", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#ef7038", - ColorType.LIGHT_ACCENT: "#f7b79b", - ColorType.DARK_ACCENT: "#551e0a", - }, - TagColor.YELLOW_ORANGE: { - ColorType.PRIMARY: "#fa9a2c", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#fba94b", - ColorType.LIGHT_ACCENT: "#fdd7ab", - ColorType.DARK_ACCENT: "#66330d", - }, - TagColor.YELLOW: { - ColorType.PRIMARY: "#ffd63d", - ColorType.TEXT: ColorType.DARK_ACCENT, - # ColorType.BORDER: '#ffe071', - ColorType.BORDER: "#e8af31", - ColorType.LIGHT_ACCENT: "#fff3c4", - ColorType.DARK_ACCENT: "#754312", - }, - TagColor.MINT: { - ColorType.PRIMARY: "#4aed90", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#79f2b1", - ColorType.LIGHT_ACCENT: "#c8fbe9", - ColorType.DARK_ACCENT: "#164f3e", - }, - TagColor.LIME: { - ColorType.PRIMARY: "#92e649", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#b2ed72", - ColorType.LIGHT_ACCENT: "#e9f9b7", - ColorType.DARK_ACCENT: "#405516", - }, - TagColor.LIGHT_GREEN: { - ColorType.PRIMARY: "#85ec76", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#a3f198", - ColorType.LIGHT_ACCENT: "#e7fbe4", - ColorType.DARK_ACCENT: "#2b5524", - }, - TagColor.GREEN: { - ColorType.PRIMARY: "#28bb48", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#43c568", - ColorType.LIGHT_ACCENT: "#93e2c8", - ColorType.DARK_ACCENT: "#0d3828", - }, - TagColor.TEAL: { - ColorType.PRIMARY: "#1ad9b2", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#4de3c7", - ColorType.LIGHT_ACCENT: "#a0f3e8", - ColorType.DARK_ACCENT: "#08424b", - }, - TagColor.CYAN: { - ColorType.PRIMARY: "#49e4d5", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#76ebdf", - ColorType.LIGHT_ACCENT: "#bff5f0", - ColorType.DARK_ACCENT: "#0f4246", - }, - TagColor.LIGHT_BLUE: { - ColorType.PRIMARY: "#55bbf6", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#70c6f7", - ColorType.LIGHT_ACCENT: "#bbe4fb", - ColorType.DARK_ACCENT: "#122541", - }, - TagColor.BLUE: { - ColorType.PRIMARY: "#3b87f0", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#4e95f2", - ColorType.LIGHT_ACCENT: "#aedbfa", - ColorType.DARK_ACCENT: "#122948", - }, - TagColor.BLUE_VIOLET: { - ColorType.PRIMARY: "#5948f2", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#6258f3", - ColorType.LIGHT_ACCENT: "#9cb8fb", - ColorType.DARK_ACCENT: "#1b1649", - }, - TagColor.VIOLET: { - ColorType.PRIMARY: "#874ff5", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#9360f6", - ColorType.LIGHT_ACCENT: "#c9b0fa", - ColorType.DARK_ACCENT: "#3a1860", - }, - TagColor.PURPLE: { - ColorType.PRIMARY: "#bb4ff0", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#c364f2", - ColorType.LIGHT_ACCENT: "#dda7f7", - ColorType.DARK_ACCENT: "#531862", - }, - TagColor.PEACH: { - ColorType.PRIMARY: "#f1c69c", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#f4d4b4", - ColorType.LIGHT_ACCENT: "#fbeee1", - ColorType.DARK_ACCENT: "#613f2f", - }, - TagColor.BROWN: { - ColorType.PRIMARY: "#823216", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#8a3e22", - ColorType.LIGHT_ACCENT: "#cd9d83", - ColorType.DARK_ACCENT: "#3a1804", - }, - TagColor.LAVENDER: { - ColorType.PRIMARY: "#ad8eef", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#b99ef2", - ColorType.LIGHT_ACCENT: "#d5c7fa", - ColorType.DARK_ACCENT: "#492b65", - }, - TagColor.BLONDE: { - ColorType.PRIMARY: "#efc664", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#f3d387", - ColorType.LIGHT_ACCENT: "#faebc6", - ColorType.DARK_ACCENT: "#6d461e", - }, - TagColor.AUBURN: { - ColorType.PRIMARY: "#a13220", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#aa402f", - ColorType.LIGHT_ACCENT: "#d98a7f", - ColorType.DARK_ACCENT: "#3d100a", - }, - TagColor.LIGHT_BROWN: { - ColorType.PRIMARY: "#be5b2d", - ColorType.TEXT: ColorType.DARK_ACCENT, - ColorType.BORDER: "#c4693d", - ColorType.LIGHT_ACCENT: "#e5b38c", - ColorType.DARK_ACCENT: "#4c290e", - }, - TagColor.DARK_BROWN: { - ColorType.PRIMARY: "#4c2315", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#542a1c", - ColorType.LIGHT_ACCENT: "#b78171", - ColorType.DARK_ACCENT: "#211006", - }, - TagColor.COOL_GRAY: { - ColorType.PRIMARY: "#515768", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#5b6174", - ColorType.LIGHT_ACCENT: "#9ea1c3", - ColorType.DARK_ACCENT: "#181a37", - }, - TagColor.WARM_GRAY: { - ColorType.PRIMARY: "#625550", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#6c5e57", - ColorType.LIGHT_ACCENT: "#c0a392", - ColorType.DARK_ACCENT: "#371d18", - }, - TagColor.OLIVE: { - ColorType.PRIMARY: "#4c652e", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#586f36", - ColorType.LIGHT_ACCENT: "#b4c17a", - ColorType.DARK_ACCENT: "#23300e", - }, - TagColor.BERRY: { - ColorType.PRIMARY: "#9f2aa7", - ColorType.TEXT: ColorType.LIGHT_ACCENT, - ColorType.BORDER: "#aa43b4", - ColorType.LIGHT_ACCENT: "#cc8fdc", - ColorType.DARK_ACCENT: "#41114a", - }, -} +#TAG_COLORS: dict[TagColor, dict[ColorType, Any]] = { +# TagColor.DEFAULT: { +# ColorType.PRIMARY: "#1e1e1e", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#333333", +# ColorType.LIGHT_ACCENT: "#FFFFFF", +# ColorType.DARK_ACCENT: "#222222", +# }, +# TagColor.BLACK: { +# ColorType.PRIMARY: "#111018", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#18171e", +# ColorType.LIGHT_ACCENT: "#b7b6be", +# ColorType.DARK_ACCENT: "#03020a", +# }, +# TagColor.DARK_GRAY: { +# ColorType.PRIMARY: "#24232a", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#2a2930", +# ColorType.LIGHT_ACCENT: "#bdbcc4", +# ColorType.DARK_ACCENT: "#07060e", +# }, +# TagColor.GRAY: { +# ColorType.PRIMARY: "#53525a", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#5b5a62", +# ColorType.LIGHT_ACCENT: "#cbcad2", +# ColorType.DARK_ACCENT: "#191820", +# }, +# TagColor.LIGHT_GRAY: { +# ColorType.PRIMARY: "#aaa9b0", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#b6b4bc", +# ColorType.LIGHT_ACCENT: "#cbcad2", +# ColorType.DARK_ACCENT: "#191820", +# }, +# TagColor.WHITE: { +# ColorType.PRIMARY: "#f2f1f8", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#fefeff", +# ColorType.LIGHT_ACCENT: "#ffffff", +# ColorType.DARK_ACCENT: "#302f36", +# }, +# TagColor.LIGHT_PINK: { +# ColorType.PRIMARY: "#ff99c4", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#ffaad0", +# ColorType.LIGHT_ACCENT: "#ffcbe7", +# ColorType.DARK_ACCENT: "#6c2e3b", +# }, +# TagColor.PINK: { +# ColorType.PRIMARY: "#ff99c4", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#ffaad0", +# ColorType.LIGHT_ACCENT: "#ffcbe7", +# ColorType.DARK_ACCENT: "#6c2e3b", +# }, +# TagColor.MAGENTA: { +# ColorType.PRIMARY: "#f6466f", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#f7587f", +# ColorType.LIGHT_ACCENT: "#fba4bf", +# ColorType.DARK_ACCENT: "#61152f", +# }, +# TagColor.RED: { +# ColorType.PRIMARY: "#e22c3c", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#b21f2d", +# # ColorType.BORDER: '#e54252', +# ColorType.LIGHT_ACCENT: "#f39caa", +# ColorType.DARK_ACCENT: "#440d12", +# }, +# TagColor.RED_ORANGE: { +# ColorType.PRIMARY: "#e83726", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#ea4b3b", +# ColorType.LIGHT_ACCENT: "#f5a59d", +# ColorType.DARK_ACCENT: "#61120b", +# }, +# TagColor.SALMON: { +# ColorType.PRIMARY: "#f65848", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#f76c5f", +# ColorType.LIGHT_ACCENT: "#fcadaa", +# ColorType.DARK_ACCENT: "#6f1b16", +# }, +# TagColor.ORANGE: { +# ColorType.PRIMARY: "#ed6022", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#ef7038", +# ColorType.LIGHT_ACCENT: "#f7b79b", +# ColorType.DARK_ACCENT: "#551e0a", +# }, +# TagColor.YELLOW_ORANGE: { +# ColorType.PRIMARY: "#fa9a2c", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#fba94b", +# ColorType.LIGHT_ACCENT: "#fdd7ab", +# ColorType.DARK_ACCENT: "#66330d", +# }, +# TagColor.YELLOW: { +# ColorType.PRIMARY: "#ffd63d", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# # ColorType.BORDER: '#ffe071', +# ColorType.BORDER: "#e8af31", +# ColorType.LIGHT_ACCENT: "#fff3c4", +# ColorType.DARK_ACCENT: "#754312", +# }, +# TagColor.MINT: { +# ColorType.PRIMARY: "#4aed90", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#79f2b1", +# ColorType.LIGHT_ACCENT: "#c8fbe9", +# ColorType.DARK_ACCENT: "#164f3e", +# }, +# TagColor.LIME: { +# ColorType.PRIMARY: "#92e649", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#b2ed72", +# ColorType.LIGHT_ACCENT: "#e9f9b7", +# ColorType.DARK_ACCENT: "#405516", +# }, +# TagColor.LIGHT_GREEN: { +# ColorType.PRIMARY: "#85ec76", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#a3f198", +# ColorType.LIGHT_ACCENT: "#e7fbe4", +# ColorType.DARK_ACCENT: "#2b5524", +# }, +# TagColor.GREEN: { +# ColorType.PRIMARY: "#28bb48", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#43c568", +# ColorType.LIGHT_ACCENT: "#93e2c8", +# ColorType.DARK_ACCENT: "#0d3828", +# }, +# TagColor.TEAL: { +# ColorType.PRIMARY: "#1ad9b2", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#4de3c7", +# ColorType.LIGHT_ACCENT: "#a0f3e8", +# ColorType.DARK_ACCENT: "#08424b", +# }, +# TagColor.CYAN: { +# ColorType.PRIMARY: "#49e4d5", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#76ebdf", +# ColorType.LIGHT_ACCENT: "#bff5f0", +# ColorType.DARK_ACCENT: "#0f4246", +# }, +# TagColor.LIGHT_BLUE: { +# ColorType.PRIMARY: "#55bbf6", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#70c6f7", +# ColorType.LIGHT_ACCENT: "#bbe4fb", +# ColorType.DARK_ACCENT: "#122541", +# }, +# TagColor.BLUE: { +# ColorType.PRIMARY: "#3b87f0", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#4e95f2", +# ColorType.LIGHT_ACCENT: "#aedbfa", +# ColorType.DARK_ACCENT: "#122948", +# }, +# TagColor.BLUE_VIOLET: { +# ColorType.PRIMARY: "#5948f2", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#6258f3", +# ColorType.LIGHT_ACCENT: "#9cb8fb", +# ColorType.DARK_ACCENT: "#1b1649", +# }, +# TagColor.VIOLET: { +# ColorType.PRIMARY: "#874ff5", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#9360f6", +# ColorType.LIGHT_ACCENT: "#c9b0fa", +# ColorType.DARK_ACCENT: "#3a1860", +# }, +# TagColor.PURPLE: { +# ColorType.PRIMARY: "#bb4ff0", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#c364f2", +# ColorType.LIGHT_ACCENT: "#dda7f7", +# ColorType.DARK_ACCENT: "#531862", +# }, +# TagColor.PEACH: { +# ColorType.PRIMARY: "#f1c69c", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#f4d4b4", +# ColorType.LIGHT_ACCENT: "#fbeee1", +# ColorType.DARK_ACCENT: "#613f2f", +# }, +# TagColor.BROWN: { +# ColorType.PRIMARY: "#823216", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#8a3e22", +# ColorType.LIGHT_ACCENT: "#cd9d83", +# ColorType.DARK_ACCENT: "#3a1804", +# }, +# TagColor.LAVENDER: { +# ColorType.PRIMARY: "#ad8eef", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#b99ef2", +# ColorType.LIGHT_ACCENT: "#d5c7fa", +# ColorType.DARK_ACCENT: "#492b65", +# }, +# TagColor.BLONDE: { +# ColorType.PRIMARY: "#efc664", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#f3d387", +# ColorType.LIGHT_ACCENT: "#faebc6", +# ColorType.DARK_ACCENT: "#6d461e", +# }, +# TagColor.AUBURN: { +# ColorType.PRIMARY: "#a13220", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#aa402f", +# ColorType.LIGHT_ACCENT: "#d98a7f", +# ColorType.DARK_ACCENT: "#3d100a", +# }, +# TagColor.LIGHT_BROWN: { +# ColorType.PRIMARY: "#be5b2d", +# ColorType.TEXT: ColorType.DARK_ACCENT, +# ColorType.BORDER: "#c4693d", +# ColorType.LIGHT_ACCENT: "#e5b38c", +# ColorType.DARK_ACCENT: "#4c290e", +# }, +# TagColor.DARK_BROWN: { +# ColorType.PRIMARY: "#4c2315", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#542a1c", +# ColorType.LIGHT_ACCENT: "#b78171", +# ColorType.DARK_ACCENT: "#211006", +# }, +# TagColor.COOL_GRAY: { +# ColorType.PRIMARY: "#515768", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#5b6174", +# ColorType.LIGHT_ACCENT: "#9ea1c3", +# ColorType.DARK_ACCENT: "#181a37", +# }, +# TagColor.WARM_GRAY: { +# ColorType.PRIMARY: "#625550", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#6c5e57", +# ColorType.LIGHT_ACCENT: "#c0a392", +# ColorType.DARK_ACCENT: "#371d18", +# }, +# TagColor.OLIVE: { +# ColorType.PRIMARY: "#4c652e", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#586f36", +# ColorType.LIGHT_ACCENT: "#b4c17a", +# ColorType.DARK_ACCENT: "#23300e", +# }, +# TagColor.BERRY: { +# ColorType.PRIMARY: "#9f2aa7", +# ColorType.TEXT: ColorType.LIGHT_ACCENT, +# ColorType.BORDER: "#aa43b4", +# ColorType.LIGHT_ACCENT: "#cc8fdc", +# ColorType.DARK_ACCENT: "#41114a", +# }, +#} -UI_COLORS: dict[UiColor, dict[ColorType, Any]] = { - UiColor.DEFAULT: { - ColorType.PRIMARY: "#333333", - ColorType.BORDER: "#555555", - ColorType.LIGHT_ACCENT: "#FFFFFF", - ColorType.DARK_ACCENT: "#1e1e1e", - }, - UiColor.RED: { - ColorType.PRIMARY: "#e22c3c", - ColorType.BORDER: "#e54252", - ColorType.LIGHT_ACCENT: "#f39caa", - ColorType.DARK_ACCENT: "#440d12", - }, - UiColor.GREEN: { - ColorType.PRIMARY: "#28bb48", - ColorType.BORDER: "#43c568", - ColorType.LIGHT_ACCENT: "#DDFFCC", - ColorType.DARK_ACCENT: "#0d3828", - }, - UiColor.PURPLE: { - ColorType.PRIMARY: "#C76FF3", - ColorType.BORDER: "#c364f2", - ColorType.LIGHT_ACCENT: "#EFD4FB", - ColorType.DARK_ACCENT: "#3E1555", - }, - UiColor.THEME_DARK: { - ColorType.PRIMARY: "#333333", - ColorType.BORDER: "#555555", - ColorType.LIGHT_ACCENT: "#FFFFFF", - ColorType.DARK_ACCENT: "#1e1e1e", - }, - UiColor.THEME_LIGHT: { - ColorType.PRIMARY: "#FFFFFF", - ColorType.BORDER: "#333333", - ColorType.LIGHT_ACCENT: "#999999", - ColorType.DARK_ACCENT: "#888888", - }, -} +#UI_COLORS: dict[UiColor, dict[ColorType, Any]] = { +# UiColor.DEFAULT: { +# ColorType.PRIMARY: "#333333", +# ColorType.BORDER: "#555555", +# ColorType.LIGHT_ACCENT: "#FFFFFF", +# ColorType.DARK_ACCENT: "#1e1e1e", +# }, +# UiColor.RED: { +# ColorType.PRIMARY: "#e22c3c", +# ColorType.BORDER: "#e54252", +# ColorType.LIGHT_ACCENT: "#f39caa", +# ColorType.DARK_ACCENT: "#440d12", +# }, +# UiColor.GREEN: { +# ColorType.PRIMARY: "#28bb48", +# ColorType.BORDER: "#43c568", +# ColorType.LIGHT_ACCENT: "#DDFFCC", +# ColorType.DARK_ACCENT: "#0d3828", +# }, +# UiColor.PURPLE: { +# ColorType.PRIMARY: "#C76FF3", +# ColorType.BORDER: "#c364f2", +# ColorType.LIGHT_ACCENT: "#EFD4FB", +# ColorType.DARK_ACCENT: "#3E1555", +# }, +# UiColor.THEME_DARK: { +# ColorType.PRIMARY: "#333333", +# ColorType.BORDER: "#555555", +# ColorType.LIGHT_ACCENT: "#FFFFFF", +# ColorType.DARK_ACCENT: "#1e1e1e", +# }, +# UiColor.THEME_LIGHT: { +# ColorType.PRIMARY: "#FFFFFF", +# ColorType.BORDER: "#333333", +# ColorType.LIGHT_ACCENT: "#999999", +# ColorType.DARK_ACCENT: "#888888", +# }, +#} -def get_tag_color(color_type: ColorType, color_id: TagColor) -> str: - """Return a hex value given a tag color name and ColorType. - - Args: - color_type (ColorType): The ColorType category to retrieve from. - color_id (ColorType): The color name enum to retrieve from. - - Return: - A hex value string representing a color with a leading "#". - """ - try: - if color_type == ColorType.TEXT: - text_account: ColorType = TAG_COLORS[color_id][color_type] - return get_tag_color(text_account, color_id) - - return TAG_COLORS[color_id][color_type] - except KeyError: - traceback.print_stack() - logger.error("[PALETTE] Tag color not found.", color_id=color_id) - return "#FF00FF" - - -def get_ui_color(color_type: ColorType, color_id: UiColor) -> str: - """Return a hex value given a UI color name and ColorType. - - Args: - color_type (ColorType): The ColorType category to retrieve from. - color_id (UiColor): The color name enum to retrieve from. - - Return: - A hex value string representing a color with a leading "#". - """ - try: - return UI_COLORS[color_id][color_type] - except KeyError: - traceback.print_stack() - logger.error("[PALETTE] UI color not found", color_id=color_id) - return "#FF00FF" +#def get_tag_color(color_type: ColorType, color_id: TagColor) -> str: +# """Return a hex value given a tag color name and ColorType. +# +# Args: +# color_type (ColorType): The ColorType category to retrieve from. +# color_id (ColorType): The color name enum to retrieve from. +# +# Return: +# A hex value string representing a color with a leading "#". +# """ +# try: +# if color_type == ColorType.TEXT: +# text_account: ColorType = TAG_COLORS[color_id][color_type] +# return get_tag_color(text_account, color_id) +# +# return TAG_COLORS[color_id][color_type] +# except KeyError: +# traceback.print_stack() +# logger.error("[PALETTE] Tag color not found.", color_id=color_id) +# return "#FF00FF" +# +# +#def get_ui_color(color_type: ColorType, color_id: UiColor) -> str: +# """Return a hex value given a UI color name and ColorType. +# +# Args: +# color_type (ColorType): The ColorType category to retrieve from. +# color_id (UiColor): The color name enum to retrieve from. +# +# Return: +# A hex value string representing a color with a leading "#". +# """ +# try: +# return UI_COLORS[color_id][color_type] +# except KeyError: +# traceback.print_stack() +# logger.error("[PALETTE] UI color not found", color_id=color_id) +# return "#FF00FF" diff --git a/tagstudio/src/core/utils/color.py b/tagstudio/src/core/utils/color.py index e69de29bb..c82d624d5 100644 --- a/tagstudio/src/core/utils/color.py +++ b/tagstudio/src/core/utils/color.py @@ -0,0 +1,15 @@ +from src.core.library.alchemy.models import Color, ColorNamespace +from src.core.palette import ColorType + +def get_hex_color(color: Color, color_type: ColorType) -> str: + #TODO: everything + if color_type == ColorType.PRIMARY: + return color.hex_value + elif color_type == ColorType.TEXT: + return color.hex_value + elif color_type == ColorType.BORDER: + return color.hex_value + elif color_type == ColorType.LIGHT_ACCENT: + return color.hex_value + elif color_type == ColorType.DARK_ACCENT: + return color.hex_value \ No newline at end of file From decb4f97f8c8671620f9216a3a1681b28d3f3b34 Mon Sep 17 00:00:00 2001 From: python357-1 Date: Wed, 4 Dec 2024 00:58:51 -0600 Subject: [PATCH 5/5] make colors use slugs as part of pkey and remove user_defined property --- tagstudio/src/core/library/alchemy/db.py | 12 ------ tagstudio/src/core/library/alchemy/library.py | 41 ++----------------- tagstudio/src/core/library/alchemy/models.py | 3 +- 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/tagstudio/src/core/library/alchemy/db.py b/tagstudio/src/core/library/alchemy/db.py index e28d78a56..f1a23f5d3 100644 --- a/tagstudio/src/core/library/alchemy/db.py +++ b/tagstudio/src/core/library/alchemy/db.py @@ -40,18 +40,6 @@ def make_tables(engine: Engine) -> None: with engine.connect() as conn: conn.execute(text("INSERT INTO tags (id, name, color) VALUES (999, 'temp', 1)")) conn.execute(text("DELETE FROM tags WHERE id = 999")) - - conn.execute( - text( - """ - CREATE TRIGGER IF NOT EXISTS delete_color BEFORE DELETE ON colors - WHEN OLD.user_defined = FALSE - BEGIN - SELECT RAISE(ABORT, 'Cannot delete program-defined colors'); - END; - """ - ) - ) conn.commit() diff --git a/tagstudio/src/core/library/alchemy/library.py b/tagstudio/src/core/library/alchemy/library.py index f99a5db20..fec38a6fd 100644 --- a/tagstudio/src/core/library/alchemy/library.py +++ b/tagstudio/src/core/library/alchemy/library.py @@ -93,44 +93,9 @@ def get_default_tags() -> tuple[Tag, ...]: def get_default_colors(namespace: ColorNamespace) -> list[Color]: colors: list[Color] = [ - #TODO: reduce this to limited tagstudio standard color set - Color(id=1, hex_value="#1e1e1e", name="Default", user_defined=False, namespace_id=namespace.id), - Color(id=2, hex_value="#111018", name="BLACK", user_defined=False, namespace_id=namespace.id), - Color(id=3, hex_value="#24232a", name="DARK_GRAY", user_defined=False, namespace_id=namespace.id), - Color(id=4, hex_value="#53525a", name="GRAY", user_defined=False, namespace_id=namespace.id), - Color(id=5, hex_value="#aaa9b0", name="LIGHT_GRAY", user_defined=False, namespace_id=namespace.id), - Color(id=6, hex_value="#f2f1f8", name="WHITE", user_defined=False, namespace_id=namespace.id), - Color(id=7, hex_value="#ff99c4", name="LIGHT_PINK", user_defined=False, namespace_id=namespace.id), - Color(id=8, hex_value="#ff99c4", name="PINK", user_defined=False, namespace_id=namespace.id), - Color(id=9, hex_value="#f6466f", name="MAGENTA", user_defined=False, namespace_id=namespace.id), - Color(id=10, hex_value="#e22c3c", name="RED", user_defined=False, namespace_id=namespace.id), - Color(id=11, hex_value="#e83726", name="RED_ORANGE", user_defined=False, namespace_id=namespace.id), - Color(id=12, hex_value="#f65848", name="SALMON", user_defined=False, namespace_id=namespace.id), - Color(id=13, hex_value="#ed6022", name="ORANGE", user_defined=False, namespace_id=namespace.id), - Color(id=14, hex_value="#fa9a2c", name="YELLOW_ORANGE", user_defined=False, namespace_id=namespace.id), - Color(id=15, hex_value="#ffd63d", name="YELLOW", user_defined=False, namespace_id=namespace.id), - Color(id=16, hex_value="#4aed90", name="MINT", user_defined=False, namespace_id=namespace.id), - Color(id=17, hex_value="#92e649", name="LIME", user_defined=False, namespace_id=namespace.id), - Color(id=18, hex_value="#85ec76", name="LIGHT_GREEN", user_defined=False, namespace_id=namespace.id), - Color(id=19, hex_value="#28bb48", name="GREEN", user_defined=False, namespace_id=namespace.id), - Color(id=20, hex_value="#1ad9b2", name="TEAL", user_defined=False, namespace_id=namespace.id), - Color(id=21, hex_value="#49e4d5", name="CYAN", user_defined=False, namespace_id=namespace.id), - Color(id=22, hex_value="#55bbf6", name="LIGHT_BLUE", user_defined=False, namespace_id=namespace.id), - Color(id=23, hex_value="#3b87f0", name="BLUE", user_defined=False, namespace_id=namespace.id), - Color(id=24, hex_value="#5948f2", name="BLUE_VIOLET", user_defined=False, namespace_id=namespace.id), - Color(id=25, hex_value="#874ff5", name="VIOLET", user_defined=False, namespace_id=namespace.id), - Color(id=26, hex_value="#bb4ff0", name="PURPLE", user_defined=False, namespace_id=namespace.id), - Color(id=27, hex_value="#f1c69c", name="PEACH", user_defined=False, namespace_id=namespace.id), - Color(id=28, hex_value="#823216", name="BROWN", user_defined=False, namespace_id=namespace.id), - Color(id=29, hex_value="#ad8eef", name="LAVENDER", user_defined=False, namespace_id=namespace.id), - Color(id=31, hex_value="#efc664", name="BLONDE", user_defined=False, namespace_id=namespace.id), - Color(id=32, hex_value="#a13220", name="AUBURN", user_defined=False, namespace_id=namespace.id), - Color(id=33, hex_value="#be5b2d", name="LIGHT_BROWN", user_defined=False, namespace_id=namespace.id), - Color(id=34, hex_value="#4c2315", name="DARK_BROWN", user_defined=False, namespace_id=namespace.id), - Color(id=35, hex_value="#515768", name="COOL_GRAY", user_defined=False, namespace_id=namespace.id), - Color(id=36, hex_value="#625550", name="WARM_GRAY", user_defined=False, namespace_id=namespace.id), - Color(id=37, hex_value="#4c652e", name="OLIVE", user_defined=False, namespace_id=namespace.id), - Color(id=38, hex_value="#9f2aa7", name="BERRY", user_defined=False, namespace_id=namespace.id), + #TODO: make this the full tagstudio standard color set + Color(slug='red', hex_value="#e22c3c", name="RED", namespace_id=namespace.id), + Color(slug='yellow', hex_value="#ffd63d", name="YELLOW", namespace_id=namespace.id), ] return colors diff --git a/tagstudio/src/core/library/alchemy/models.py b/tagstudio/src/core/library/alchemy/models.py index 52f2fecbe..195710568 100644 --- a/tagstudio/src/core/library/alchemy/models.py +++ b/tagstudio/src/core/library/alchemy/models.py @@ -221,12 +221,11 @@ class ColorNamespace(Base): class Color(Base): __tablename__ = "colors" - id: Mapped[int] = mapped_column(primary_key=True) + slug: Mapped[str] = mapped_column(primary_key=True) namespace_id: Mapped[int] = mapped_column(ForeignKey("color_namespaces.id"), primary_key = True) hex_value: Mapped[str] = mapped_column() name: Mapped[str] = mapped_column() - user_defined: Mapped[bool] = mapped_column(default=True) class ValueType(Base): """Define Field Types in the Library.