@@ -77,6 +77,16 @@ public static TextFormatter of(@NotNull String contents, @NotNull Color foregrou
77
77
return TextFormatter .of (contents ).withForegroundColor (foreground );
78
78
}
79
79
80
+ /**
81
+ * Creates a new {@link TextFormatter} with the specified contents and colors.
82
+ * @param contents The contents of the formatter.
83
+ * @param foreground The foreground color of the formatter.
84
+ * @param background The background color of the formatter.
85
+ */
86
+ public static TextFormatter of (@ NotNull String contents , @ NotNull Color foreground , @ NotNull Color background ) {
87
+ return TextFormatter .of (contents ).withColors (foreground , background );
88
+ }
89
+
80
90
/**
81
91
* Creates a new {@link TextFormatter} with empty contents.
82
92
* @return a new {@link TextFormatter} with empty contents
@@ -85,6 +95,18 @@ public static TextFormatter create() {
85
95
return new TextFormatter ("" );
86
96
}
87
97
98
+ /**
99
+ * Returns a new {@link TextFormatter} with the specified contents and the error formatting.
100
+ * <p>
101
+ * The error formatting is a bold, black text with a bright red background.
102
+ * @param msg The contents of the formatter.
103
+ * @return a new {@link TextFormatter} with the specified contents and the error formatting
104
+ * */
105
+ public static @ NotNull TextFormatter error (@ NotNull String msg ) {
106
+ return TextFormatter .of (msg , Color .BLACK , Color .BRIGHT_RED ).addFormat (FormatOption .BOLD );
107
+ }
108
+
109
+
88
110
/**
89
111
* Adds the specified formatting options to the formatter.
90
112
* @param options The formatting options to add.
@@ -336,11 +358,6 @@ else if (TextFormatter.startWithDefaultColorIfNotDefined && this.parent == null)
336
358
return buff .toString ();
337
359
}
338
360
339
- /** Returns a template for a {@link TextFormatter} that is used for errors */
340
- public static @ NotNull TextFormatter ERROR (@ NotNull String msg ) {
341
- return TextFormatter .of (msg , Color .BRIGHT_RED ).addFormat (FormatOption .REVERSE , FormatOption .BOLD );
342
- }
343
-
344
361
/**
345
362
* Returns a string with a terminal sequence with the specified code.
346
363
* (e.g. {@code "ESC[<code here>m"})
0 commit comments