CodeCrafter47 / TabOverlayCommon

GNU General Public License v3.0
1 stars 5 forks source link

Add format options for !color_animation #6

Closed Andre601 closed 2 years ago

Andre601 commented 2 years ago

Please, please, PLEASE give feedback on this! I'm not sure if I understand the system good enough to have made the best option available here...

The goal is to add boolean options to enable individual formatting options to a !color_animation If everything works as I assume, should this now allow a placeholder like this:

example:
  !color_animation
  colors: ['#abcdef', '#123456']
  distance: 5
  speed: 1
  bold: true
  italic: true
  underline: false # Not needed as it defaults to false anyways... Just to demonstrate.
Andre601 commented 2 years ago

Decided to switch to a String list instead of having that many boolean options. This means the new format would be something similar to this:

example:
  !color_animation
  colors: ['#abcdef', '#123456']
  formats: ['BOLD', 'ITALIC']
  distance: 5
  speed: 1
Andre601 commented 2 years ago

This seems good overall. I'd prefer not to use the TextColor class for the format codes, since it has been created specifically to handle colors.

What alternative would you recommend? String seems nice, tho I feel like it would be weird? Also, if we would go with that, what would be the best approach to handle possible cases like "BOLD, ITALIC" and BOLD,ITALIC?

Additionally, where should I put the finding/handling of the formatting codes if not in the TextColor? Making a separate class just for this seems overkill to me.

CodeCrafter47 commented 2 years ago

I'd be in favor of a separate class, if it is needed. Most libraries and also minecraft itself have moved to separating colors and format.

Andre601 commented 2 years ago

I pushed a change that uses String now. Also added a sanitizeFormats(String format) method that will make sure the String is valid formatting codes and not random garbage text.

Code was taken from a previous PlaceholderAPI version (Was used there for color formatting)