TagStudio icon indicating copy to clipboard operation
TagStudio copied to clipboard

[Feature Request]: Add import/export options for Tag Colors

Open reddraconi opened this issue 9 months ago • 1 comments

Checklist

  • [x] I am using an up-to-date version.
  • [x] I have read the documentation.
  • [x] I have searched existing issues.

Description

It would be handy to have a way to import and export a plaintext file containing a color scheme, rather than use the GUI to create one. This would let us do things like create and import a list of HTML colors or other standardized colors (e.g., FreeTone, etc.)

Solution

Importing a scheme

  1. User navigates to Edit > Manage Tag Colors
  2. A new button should placed near New Namespace (perhaps Import Namespace?)
  3. A file picker should pop up, allowing the user to pick a theme file
  4. The theme file should be validated for correctness and handled appropriately if the user did a silly thing
  5. If everything's good, it should be added to the list of tag color namespaces in the Manage Tag Colors window.

Note: I'm not sure of the best way to tell a user their theme is bad. Maybe just import whatever we can, then complain about the rest, or just give them a clue as to where the problem is and refuse the whole file?

Exporting a scheme

  1. User navigates to Edit > Manage Tag Colors
  2. A new button should placed near New Namespace (perhaps Export Namespace?)
  3. The user clicks an existing namespace group and clicks Export Namespace
  4. A file picker should pop up, allowing the user to save the theme file

Theme file format?

Something simple that can be hand-jammed or built by Python or the like. TOML or JSON come to mind immediately.

Example Theme (TOML)

There's probably a better way to lay this out. :)

` [colortheme] namespace = "Solarized Dark"

color1_name = "Base03_Yellow" color1_primary = "hex:#002b36" color1_secondary = "hsv:45,255,181" color1_secondary_for_border = False ; Default

color2_name = "Base03_Orange" color2_primary = "rgb:0,43,54" color2_secondary = "hex:#cb4b16" color3_secondary_for_border = True `

Alternatives

No response

reddraconi avatar Mar 14 '25 15:03 reddraconi

Already planned and in progress for 9.6, or possibly even a 9.5.x patch 👍

I've been workshopping a TOML-based format for a few weeks now, though I still need to make some tweaks to the schema now that the custom color feature is finalized. If you're curious, it looks something like this:

pack_format = 1
version = 1.0
author = "CyanVoxel"
title = "CGA Tag Colors"
description = "A collection of 16 + 1 CGA tag colors!"

[[namespaces]]
namespace = "cyanvoxel.cga"
name = "CGA Palette"

[[colors]]
namespace = "cyanvoxel.cga"
slug = "black"
name = "Black"
primary = "#000000"

[[colors]]
namespace = "cyanvoxel.cga"
slug = "blue"
name = "Blue"
primary = "#0000AA"

...

This is also an approach I plan on using for sharing tags themselves in the future, so the color sharing system will act as sort of a test run for that.

CyanVoxel avatar Mar 15 '25 03:03 CyanVoxel