-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: user defined colors #623
base: main
Are you sure you want to change the base?
Conversation
Initial ideas for user-defined colors This implementation would add a new table for user defined colors and pre-populate it with the default colors. This would allow for the colors to be ID based, as mentioned on the roadmap, and allow them to have custom names and hex values. The roadmap also mentions having the base colors be non-removable, which is what the following trigger does (currently in
User-defined colors can still have their names and hex values updated to whatever the user wants, but they cannot be removed from the database - any attempts to do so will result in a SQL error. |
@CyanVoxel Do these user-defined colors need support for all the ColorTypes like in the current
|
Thank you for asking! The plan is to get rid of this system, and have all colors (built-in + user) be based off of a single hex value per color. From there, we can extrapolate any accent colors and detect whether it needs dark or light text programmatically. That function would likely need a lot of back-and-forth tweaking so I wouldn't worry about nailing it, just having something that works decently enough in its place. |
Were you thinking this function would just take a ColorType and a hex value/Color? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyanVoxel i made some comments for stuff i wanted your input on
if color.name == color_name.upper().replace(" ", "_"): | ||
return color | ||
return TagColor.DEFAULT | ||
#class TSStandardColors(enum.IntEnum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you said you aren't a fan of enums, but I think it would be good to have an enum that just has the IDs of colors in the default tagstudio color pack (whatever we will call it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll concede to this ;)
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if you have settled on a final list of colors you do want in the default pack, but the sooner I can have that the better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem, I'll get that fleshed out for you
from src.core.palette import ColorType | ||
|
||
def get_hex_color(color: Color, color_type: ColorType) -> str: | ||
#TODO: everything |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is obviously just a placeholder, I don't even know if this will be the final location for it, but for right now anything you want to do with the color function can be done here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the Color
object will take care of the color ID + namespace identification, I think this should take care of it!
This PR implements user-defined tag colors (discussed on the roadmap and would close #264)