Skip to content
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

An editable color registry, i.e. custom named colors #1101

Open
Romindous opened this issue Aug 17, 2024 · 1 comment
Open

An editable color registry, i.e. custom named colors #1101

Romindous opened this issue Aug 17, 2024 · 1 comment

Comments

@Romindous
Copy link

So, as it stands, there is a set number of named colors that are recognized by adventure, and are used by minimessage. One can "add" more colors by using a TagResolver, which should substitute a hex code when reading the tag name (1st image)
image

However, the problem shows when the new color isn't in a simple form, such as by using a gradient, where the name is simply not recognized (2nd image)
image

Could we maybe get a way to straight up add NamedTextColors? Maybe some way to register them in minimessage?

@WasabiThumb
Copy link

WasabiThumb commented Aug 17, 2024

NamedTextColor is global state (essentially an enum) and probably not a good idea to modify, custom colors should only exist within the lifetime of the MiniMessage instance they are attached to. If you just want to create your own TextColor enums, you can accomplish this with a class in your own namespace.

This could maybe look like builder().color("name", /* TextColor instance */) with perhaps helper methods for hex codes/RGB int literals

Watching this in case I have to implement it in minimessage-js ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants