Closed leinardi closed 4 years ago
Perhaps something similar to what regulator is doing: https://github.com/kaleidocode-app/regulator/blob/master/src/code.ts
With this code the plugin is renaming the Color style so I assume it should also be possible to change the color value.
The plugin allows already to import many colors in bulk but, if I'm not wrong, doesn't allow to upgrade the previously imported colors.
@leinardi yeah you are right. As you probably saw in the code the styles are getting assigned a unique id. Do you think overwriting should be the default behavior or should it be adjustable via checkbox?
I think this feature should be optional (with a checkbox): I can't think of any use case where you need to actually have duplicate colors but, if there are currently users that actually need the plugin to behave like that, it won't be right to break it for them.
Regarding the logic for this change I would suggest something like this:
getLocalPaintStyles()
and, if the current style name matches case sensitively with one of the colors from the TailwindCSS, update the current color. If you reached the end of the list without finding a match, create a new style.If you don't mind I'd like to add a couple of other feature request needed by the theamable DS I'm working on (I'll create a separate issue for them).
Added in #87 @all-contributors please add @leinardi for ideas
@impulse
I've put up a pull request to add @leinardi! :tada:
@impulse @KA95DEV thank you both! This will make my work so much easier!
Hi, I just found this plugin while I was looking for an automated way to import color styles. The plugin allows already to import many colors in bulk but, if I'm not wrong, doesn't allow to upgrade the previously imported colors.
I'm currently building a themeable design system with many different themes and hundreds of color styles so it would be really great if there was a way to update an already existing color if, for example, the name matches.