Package me.croabeast.prismatic.color
Interface ColorPattern
public interface ColorPattern
Defines a contract for applying and stripping color formatting to strings.
Implementations of ColorPattern are responsible for transforming text by inserting color codes
(e.g. for gradients, rainbow effects, or single color changes) and for removing such formatting from text.
This is useful in contexts where dynamic text colorization is desired, such as chat messages, GUI displays,
or custom logging.
COLOR_PATTERNS,
which includes implementations like MultiColor and SingleColor.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<ColorPattern> A default list of color patterns available for processing text. -
Method Summary
-
Field Details
-
COLOR_PATTERNS
A default list of color patterns available for processing text.
-
-
Method Details
-
strip
Strips the color formatting applied by this pattern from the given string.This method removes any inserted color codes, resulting in a plain text string.
- Parameters:
string- the text from which to remove color formatting- Returns:
- the plain text string with all color codes removed
-
apply
Applies the color pattern to the given string.This method transforms the input text by inserting color codes according to the pattern's rules. The
isLegacyflag specifies whether legacy color formatting should be used.- Parameters:
string- the input text to which the color pattern will be appliedisLegacy-trueif legacy formatting (e.g. 16-color mode) should be used;falsefor modern RGB support- Returns:
- the transformed, colorized string
-