Skip to content

Commit 28de21a

Browse files
authored
feat(ui)!: user-created tag colors (#801)
* feat: custom tag colors * ui: minor ui polish * ui: add confirmation for deleting colors * ui: match tag_color_preview focused style * ui: reduce spacing between color swatch groups * ui!: change default behavior of secondary color The secondary color now acts as only the text color by default, with the new `color_border` bool serving to optionally restore the previous text + colored border behavior. * ui: adjust focused tag/color button styles * fix: avoid namespace collision * fix: make reserved namespace check case-insensitive * ui: add namespace description + prompt * fix: don't reset tag color if none are chosen * refactor(ui): use form layout for build_color * fix(ui): dynamically scale field title widget * feat(ui): add additional tag shade colors Add "burgundy", "dark-teal", and "dark_lavender" tag colors. * fix: don't check for self in collision checks * fix: update tag references on color update * fix(ui): stop fields widgets expanding indefinitely
1 parent 2173d1d commit 28de21a

19 files changed

+1678
-101
lines changed

tagstudio/resources/translations/en.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
"app.git": "Git Commit",
33
"app.pre_release": "Pre-Release",
44
"app.title": "{base_title} - Library '{library_dir}'",
5+
"color_manager.title": "Manage Tag Colors",
6+
"color.color_border": "Use Secondary Color for Border",
7+
"color.confirm_delete": "Are you sure you want to delete the color \"{color_name}\"?",
8+
"color.delete": "Delete Tag",
9+
"color.import_pack": "Import Color Pack",
10+
"color.name": "Name",
11+
"color.namespace.delete.prompt": "Are you sure you want to delete this color namespace? This will delete ALL colors in the namespace along with it!",
12+
"color.namespace.delete.title": "Delete Color Namespace",
13+
"color.new": "New Color",
14+
"color.placeholder": "Color",
15+
"color.primary_required": "Primary Color (Required)",
16+
"color.primary": "Primary Color",
17+
"color.secondary": "Secondary Color",
518
"color.title.no_color": "No Color",
619
"drop_import.description": "The following files match file paths that already exist in the library",
720
"drop_import.duplicates_choice.plural": "The following {count} files match file paths that already exist in the library.",
@@ -11,6 +24,7 @@
1124
"drop_import.progress.label.singular": "Importing New Files...\n1 File imported.{suffix}",
1225
"drop_import.progress.window_title": "Import Files",
1326
"drop_import.title": "Conflicting File(s)",
27+
"edit.color_manager": "Manage Tag Colors",
1428
"edit.tag_manager": "Manage Tags",
1529
"entries.duplicate.merge.label": "Merging Duplicate Entries...",
1630
"entries.duplicate.merge": "Merge Duplicate Entries",
@@ -96,6 +110,7 @@
96110
"generic.recent_libraries": "Recent Libraries",
97111
"generic.rename_alt": "&Rename",
98112
"generic.rename": "Rename",
113+
"generic.reset": "Reset",
99114
"generic.save": "Save",
100115
"generic.skip_alt": "&Skip",
101116
"generic.skip": "Skip",
@@ -143,6 +158,10 @@
143158
"json_migration.title.old_lib": "<h2>v9.4 Library</h2>",
144159
"json_migration.title": "Save Format Migration: \"{path}\"",
145160
"landing.open_create_library": "Open/Create Library {shortcut}",
161+
"library_object.name_required": "Name (Required)",
162+
"library_object.name": "Name",
163+
"library_object.slug_required": "ID Slug (Required)",
164+
"library_object.slug": "ID Slug",
146165
"library.field.add": "Add Field",
147166
"library.field.confirm_remove": "Are you sure you want to remove this \"{name}\" field?",
148167
"library.field.mixed_data": "Mixed Data",
@@ -175,8 +194,8 @@
175194
"menu.file.save_backup": "&Save Library Backup",
176195
"menu.file.save_library": "Save Library",
177196
"menu.file": "&File",
178-
"menu.help": "&Help",
179197
"menu.help.about": "About",
198+
"menu.help": "&Help",
180199
"menu.macros.folders_to_tags": "Folders to Tags",
181200
"menu.macros": "&Macros",
182201
"menu.select": "Select",
@@ -185,6 +204,11 @@
185204
"menu.tools": "&Tools",
186205
"menu.view": "&View",
187206
"menu.window": "Window",
207+
"namespace.create.description_color": "Tag colors use namespaces as color palette groups. All custom colors must be under a namespace group first.",
208+
"namespace.create.description": "Namespaces are used by TagStudio to separate groups of items such as tags and colors in a way that makes them easy to export and share. Namespaces starting with \"tagstudio\" are reserved by TagStudio for internal use.",
209+
"namespace.create.title": "Create Namespace",
210+
"namespace.new.button": "New Namespace",
211+
"namespace.new.prompt": "Create a New Namespace to Start Adding Custom Colors!",
188212
"preview.no_selection": "No Items Selected",
189213
"select.add_tag_to_selected": "Add Tag to Selected",
190214
"select.all": "Select All",
@@ -228,6 +252,7 @@
228252
"tag.create": "Create Tag",
229253
"tag.disambiguation.tooltip": "Use this tag for disambiguation",
230254
"tag.edit": "Edit Tag",
255+
"tag.is_category": "Is Category",
231256
"tag.name": "Name",
232257
"tag.new": "New Tag",
233258
"tag.parent_tags.add": "Add Parent Tag(s)",

tagstudio/src/core/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@
2525
TAG_META = 2
2626
RESERVED_TAG_START = 0
2727
RESERVED_TAG_END = 999
28+
29+
RESERVED_NAMESPACE_PREFIX = "tagstudio"

tagstudio/src/core/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ class LibraryPrefs(DefaultEnum):
7171
IS_EXCLUDE_LIST = True
7272
EXTENSION_LIST: list[str] = [".json", ".xmp", ".aae"]
7373
PAGE_SIZE: int = 500
74-
DB_VERSION: int = 7
74+
DB_VERSION: int = 8

tagstudio/src/core/library/alchemy/default_color_groups.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ def pastels() -> list[TagColorGroup]:
307307

308308

309309
def shades() -> list[TagColorGroup]:
310+
burgundy = TagColorGroup(
311+
slug="burgundy",
312+
namespace="tagstudio-shades",
313+
name="Burgundy",
314+
primary="#6E1C24",
315+
)
310316
auburn = TagColorGroup(
311317
slug="auburn",
312318
namespace="tagstudio-shades",
@@ -319,19 +325,31 @@ def shades() -> list[TagColorGroup]:
319325
name="Olive",
320326
primary="#4C652E",
321327
)
328+
dark_teal = TagColorGroup(
329+
slug="dark-teal",
330+
namespace="tagstudio-shades",
331+
name="Dark Teal",
332+
primary="#1F5E47",
333+
)
322334
navy = TagColorGroup(
323335
slug="navy",
324336
namespace="tagstudio-shades",
325337
name="Navy",
326338
primary="#104B98",
327339
)
340+
dark_lavender = TagColorGroup(
341+
slug="dark_lavender",
342+
namespace="tagstudio-shades",
343+
name="Dark Lavender",
344+
primary="#3D3B6C",
345+
)
328346
berry = TagColorGroup(
329347
slug="berry",
330348
namespace="tagstudio-shades",
331349
name="Berry",
332350
primary="#9F2AA7",
333351
)
334-
return [auburn, olive, navy, berry]
352+
return [burgundy, auburn, olive, dark_teal, navy, dark_lavender, berry]
335353

336354

337355
def earth_tones() -> list[TagColorGroup]:
@@ -421,104 +439,119 @@ def neon() -> list[TagColorGroup]:
421439
name="Neon Red",
422440
primary="#180607",
423441
secondary="#E22C3C",
442+
color_border=True,
424443
)
425444
neon_red_orange = TagColorGroup(
426445
slug="neon-red-orange",
427446
namespace="tagstudio-neon",
428447
name="Neon Red Orange",
429448
primary="#220905",
430449
secondary="#E83726",
450+
color_border=True,
431451
)
432452
neon_orange = TagColorGroup(
433453
slug="neon-orange",
434454
namespace="tagstudio-neon",
435455
name="Neon Orange",
436456
primary="#1F0D05",
437457
secondary="#ED6022",
458+
color_border=True,
438459
)
439460
neon_amber = TagColorGroup(
440461
slug="neon-amber",
441462
namespace="tagstudio-neon",
442463
name="Neon Amber",
443464
primary="#251507",
444465
secondary="#FA9A2C",
466+
color_border=True,
445467
)
446468
neon_yellow = TagColorGroup(
447469
slug="neon-yellow",
448470
namespace="tagstudio-neon",
449471
name="Neon Yellow",
450472
primary="#2B1C0B",
451473
secondary="#FFD63D",
474+
color_border=True,
452475
)
453476
neon_lime = TagColorGroup(
454477
slug="neon-lime",
455478
namespace="tagstudio-neon",
456479
name="Neon Lime",
457480
primary="#1B220C",
458481
secondary="#92E649",
482+
color_border=True,
459483
)
460484
neon_green = TagColorGroup(
461485
slug="neon-green",
462486
namespace="tagstudio-neon",
463487
name="Neon Green",
464488
primary="#091610",
465489
secondary="#45D649",
490+
color_border=True,
466491
)
467492
neon_teal = TagColorGroup(
468493
slug="neon-teal",
469494
namespace="tagstudio-neon",
470495
name="Neon Teal",
471496
primary="#09191D",
472497
secondary="#22D589",
498+
color_border=True,
473499
)
474500
neon_cyan = TagColorGroup(
475501
slug="neon-cyan",
476502
namespace="tagstudio-neon",
477503
name="Neon Cyan",
478504
primary="#0B191C",
479505
secondary="#3DDBDB",
506+
color_border=True,
480507
)
481508
neon_blue = TagColorGroup(
482509
slug="neon-blue",
483510
namespace="tagstudio-neon",
484511
name="Neon Blue",
485512
primary="#09101C",
486513
secondary="#3B87F0",
514+
color_border=True,
487515
)
488516
neon_indigo = TagColorGroup(
489517
slug="neon-indigo",
490518
namespace="tagstudio-neon",
491519
name="Neon Indigo",
492520
primary="#150B24",
493521
secondary="#874FF5",
522+
color_border=True,
494523
)
495524
neon_purple = TagColorGroup(
496525
slug="neon-purple",
497526
namespace="tagstudio-neon",
498527
name="Neon Purple",
499528
primary="#1E0B26",
500529
secondary="#BB4FF0",
530+
color_border=True,
501531
)
502532
neon_magenta = TagColorGroup(
503533
slug="neon-magenta",
504534
namespace="tagstudio-neon",
505535
name="Neon Magenta",
506536
primary="#220A13",
507537
secondary="#F64680",
538+
color_border=True,
508539
)
509540
neon_pink = TagColorGroup(
510541
slug="neon-pink",
511542
namespace="tagstudio-neon",
512543
name="Neon Pink",
513544
primary="#210E15",
514545
secondary="#FF62AF",
546+
color_border=True,
515547
)
516548
neon_white = TagColorGroup(
517549
slug="neon-white",
518550
namespace="tagstudio-neon",
519551
name="Neon White",
520552
primary="#131315",
521553
secondary="#F2F1F8",
554+
color_border=True,
522555
)
523556
return [
524557
neon_red,

0 commit comments

Comments
 (0)