From fc777e7defbe0780774e8e360101f734cb0fb062 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 12 Dec 2022 17:30:24 +0100 Subject: [PATCH] ChatConfig now defaults to Pandacube coloring --- .../fr/pandacube/lib/chat/ChatConfig.java | 92 ++++++++++++++++--- 1 file changed, 79 insertions(+), 13 deletions(-) diff --git a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatConfig.java b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatConfig.java index 75e3668..34fedd2 100644 --- a/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatConfig.java +++ b/pandalib-chat/src/main/java/fr/pandacube/lib/chat/ChatConfig.java @@ -13,70 +13,70 @@ public class ChatConfig { /** * The color used for decoration. */ - public static TextColor decorationColor = NamedTextColor.YELLOW; + public static TextColor decorationColor = PandaTheme.CHAT_DECORATION_COLOR; /** * The character used as a pattern for decoration. */ - public static char decorationChar = '-'; + public static char decorationChar = PandaTheme.CHAT_DECORATION_CHAR; /** * The default margin for left and right aligned text. */ - public static int nbCharMargin = 1; + public static int nbCharMargin = PandaTheme.CHAT_NB_CHAR_MARGIN; /** * The color used for successful messages. */ - public static TextColor successColor = NamedTextColor.GREEN; + public static TextColor successColor = PandaTheme.CHAT_SUCCESS_COLOR; /** * The color used for error/failure messages. */ - public static TextColor failureColor = NamedTextColor.RED; + public static TextColor failureColor = PandaTheme.CHAT_FAILURE_COLOR; /** * the color used for informational messages. */ - public static TextColor infoColor = NamedTextColor.GOLD; + public static TextColor infoColor = PandaTheme.CHAT_INFO_COLOR; /** * The color used for warning messages. */ - public static TextColor warningColor = NamedTextColor.GOLD; + public static TextColor warningColor = PandaTheme.CHAT_WARNING_COLOR; /** * The color used to display data in a message. */ - public static TextColor dataColor = NamedTextColor.GRAY; + public static TextColor dataColor = PandaTheme.CHAT_DATA_COLOR; /** * The color used for displayed URLs and clickable URLs. */ - public static TextColor urlColor = NamedTextColor.GREEN; + public static TextColor urlColor = PandaTheme.CHAT_URL_COLOR; /** * The color used for displayed commands and clickable commands. */ - public static TextColor commandColor = NamedTextColor.GRAY; + public static TextColor commandColor = PandaTheme.CHAT_COMMAND_COLOR; /** * The color sued to display a command that is highlighted. For example, the current page in a pagination. */ - public static TextColor highlightedCommandColor = NamedTextColor.WHITE; + public static TextColor highlightedCommandColor = PandaTheme.CHAT_COMMAND_HIGHLIGHTED_COLOR; /** * The color used for broadcasted messages. * It is often used in combination with {@link #prefix}. */ - public static TextColor broadcastColor = NamedTextColor.YELLOW; + public static TextColor broadcastColor = PandaTheme.CHAT_BROADCAST_COLOR; /** * The prefix used for prefixed messages. * It can be a sylized name of the server, like {@code "[Pandacube] "}. * It is often used in combination with {@link #broadcastColor}. */ - public static Supplier prefix; + public static Supplier prefix = PandaTheme::CHAT_MESSAGE_PREFIX; /** * Gets the width of the configured {@link #prefix}. @@ -87,4 +87,70 @@ public class ChatConfig { Chat c; return prefix == null ? 0 : (c = prefix.get()) == null ? 0 : ChatUtil.componentWidth(c.getAdv(), console); } + + + + + + + public static class PandaTheme { + + public static final TextColor CHAT_GREEN_1_NORMAL = TextColor.fromHexString("#3db849"); // h=126 s=50 l=48 + public static final TextColor CHAT_GREEN_2 = TextColor.fromHexString("#5ec969"); // h=126 s=50 l=58 + public static final TextColor CHAT_GREEN_3 = TextColor.fromHexString("#85d68d"); // h=126 s=50 l=68 + public static final TextColor CHAT_GREEN_4 = TextColor.fromHexString("#abe3b0"); // h=126 s=50 l=78 + + public static final TextColor CHAT_GREEN_SATMAX = TextColor.fromHexString("#00ff19"); // h=126 s=100 l=50 + public static final TextColor CHAT_GREEN_1_SAT = TextColor.fromHexString("#20d532"); // h=126 s=50 l=48 + public static final TextColor CHAT_GREEN_2_SAT = TextColor.fromHexString("#45e354"); // h=126 s=50 l=58 + public static final TextColor CHAT_GREEN_3_SAT = TextColor.fromHexString("#71ea7d"); // h=126 s=50 l=68 + public static final TextColor CHAT_GREEN_4_SAT = TextColor.fromHexString("#9df0a6"); // h=126 s=50 l=78 + + public static final TextColor CHAT_BROWN_1 = TextColor.fromHexString("#b26d3a"); // h=26 s=51 l=46 + public static final TextColor CHAT_BROWN_2 = TextColor.fromHexString("#cd9265"); // h=26 s=51 l=60 + public static final TextColor CHAT_BROWN_3 = TextColor.fromHexString("#e0bb9f"); // h=26 s=51 l=75 + + public static final TextColor CHAT_BROWN_1_SAT = TextColor.fromHexString("#b35c19"); // h=26 s=75 l=40 + public static final TextColor CHAT_BROWN_2_SAT = TextColor.fromHexString("#e28136"); // h=26 s=51 l=55 + public static final TextColor CHAT_BROWN_3_SAT = TextColor.fromHexString("#ecab79"); // h=26 s=51 l=70 + + public static final TextColor CHAT_GRAY_MID = TextColor.fromHexString("#888888"); + + public static final TextColor CHAT_BROADCAST_COLOR = NamedTextColor.YELLOW; + + + public static final TextColor CHAT_DECORATION_COLOR = CHAT_GREEN_1_NORMAL; + public static final char CHAT_DECORATION_CHAR = '-'; + public static final TextColor CHAT_URL_COLOR = CHAT_GREEN_1_NORMAL; + public static final TextColor CHAT_COMMAND_COLOR = CHAT_GRAY_MID; + public static final TextColor CHAT_COMMAND_HIGHLIGHTED_COLOR = NamedTextColor.WHITE; + public static final TextColor CHAT_INFO_COLOR = CHAT_GREEN_4; + public static final TextColor CHAT_WARNING_COLOR = CHAT_BROWN_2_SAT; + public static final TextColor CHAT_SUCCESS_COLOR = CHAT_GREEN_SATMAX; + public static final TextColor CHAT_FAILURE_COLOR = TextColor.fromHexString("#ff3333"); + public static final TextColor CHAT_DATA_COLOR = CHAT_GRAY_MID; + + + public static final TextColor CHAT_PM_PREFIX_DECORATION = CHAT_BROWN_2_SAT; + public static final TextColor CHAT_PM_SELF_MESSAGE = CHAT_GREEN_2; + public static final TextColor CHAT_PM_OTHER_MESSAGE = CHAT_GREEN_4; + + + public static final TextColor CHAT_DISCORD_LINK_COLOR = TextColor.fromHexString("#00aff4"); + + /** + * Number of decoration character to put between the text and the border of + * the line for left and right aligned text. + */ + public static final int CHAT_NB_CHAR_MARGIN = 1; + + + public static Chat CHAT_MESSAGE_PREFIX() { + return Chat.text("[") + .broadcastColor() + .thenDecoration("Serveur") + .thenText("] "); + } + + } }