From c06f3bb336c29edf116b6fbeb9f5b073319edb99 Mon Sep 17 00:00:00 2001 From: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> Date: Mon, 27 Jan 2025 11:39:42 -0800 Subject: [PATCH] feat!: expanded tag color system (#709) * attempt at adding `TagColor` table * store both columns of `TagColor` inside `Tag` table * fix: fix tag color relationships * refactor: replace TagColor enums with TagColorGroup system * ui: derive tag accent colors from primary * refactor: move dynamic tag color logic, apply to "+" button * feat(ui): add neon tag colors * remove tag text color field * ui: use secondary color for border and text * ui: add TagColorPreview widget * feat(ui): add new tag color selector * ui: add color name tooltips * ui: tweak tag colors and selector * feat: add `namespaces` table * translations: add + update translation keys * tests: update fixtures * chore: code cleanup * ui: add spacing between color groups * fix: expand refactor to create and add button * chore: format with ruff --- tagstudio/resources/translations/en.json | 5 +- tagstudio/src/core/enums.py | 2 +- tagstudio/src/core/library/alchemy/db.py | 4 +- .../library/alchemy/default_color_groups.py | 539 ++++++++++++++++++ tagstudio/src/core/library/alchemy/enums.py | 8 +- tagstudio/src/core/library/alchemy/library.py | 89 ++- tagstudio/src/core/library/alchemy/models.py | 69 ++- tagstudio/src/core/palette.py | 264 +-------- tagstudio/src/qt/modals/build_tag.py | 110 ++-- tagstudio/src/qt/modals/folders_to_tags.py | 9 +- .../src/qt/modals/tag_color_selection.py | 167 ++++++ tagstudio/src/qt/modals/tag_search.py | 63 +- tagstudio/src/qt/widgets/migration_modal.py | 19 +- .../src/qt/widgets/preview/preview_thumb.py | 2 +- tagstudio/src/qt/widgets/tag.py | 91 ++- tagstudio/src/qt/widgets/tag_color_preview.py | 128 +++++ tagstudio/tests/conftest.py | 12 +- .../search_library/.TagStudio/ts_library.json | 432 +++++++++++++- .../.TagStudio/ts_library.sqlite | Bin 81920 -> 98304 bytes tagstudio/tests/qt/test_tag_panel.py | 2 +- 20 files changed, 1619 insertions(+), 396 deletions(-) create mode 100644 tagstudio/src/core/library/alchemy/default_color_groups.py create mode 100644 tagstudio/src/qt/modals/tag_color_selection.py create mode 100644 tagstudio/src/qt/widgets/tag_color_preview.py diff --git a/tagstudio/resources/translations/en.json b/tagstudio/resources/translations/en.json index 7aee729c..8076d87a 100644 --- a/tagstudio/resources/translations/en.json +++ b/tagstudio/resources/translations/en.json @@ -2,6 +2,7 @@ "app.git": "Git Commit", "app.pre_release": "Pre-Release", "app.title": "{base_title} - Library '{library_dir}'", + "color.title.no_color": "No Color", "drop_import.description": "The following files have filenames already exist in the library", "drop_import.duplicates_choice.plural": "The following {count} files have filenames that already exist in the library.", "drop_import.duplicates_choice.singular": "The following file has a filename that already exists in the library.", @@ -88,6 +89,7 @@ "generic.filename": "Filename", "generic.navigation.back": "Back", "generic.navigation.next": "Next", + "generic.none": "None", "generic.overwrite_alt": "&Overwrite", "generic.overwrite": "Overwrite", "generic.paste": "Paste", @@ -131,7 +133,7 @@ "json_migration.heading.paths": "Paths:", "json_migration.heading.shorthands": "Shorthands:", "json_migration.heading.tags": "Tags:", - "json_migration.info.description": "Library save files created with TagStudio versions 9.4 and below will need to be migrated to the new v9.5+ format.

What you need to know:

", + "json_migration.info.description": "Library save files created with TagStudio versions 9.4 and below will need to be migrated to the new v9.5+ format.

What you need to know:

What's changed: