From 7ca4ea3d136db420e29f82535b2c6f1d59e6aa28 Mon Sep 17 00:00:00 2001 From: Hen <68553709+henmalib@users.noreply.github.com> Date: Sun, 24 Nov 2024 03:16:41 +0100 Subject: [PATCH] RoleColorEverywhere: Fix message headers colors (#3036) --- src/plugins/roleColorEverywhere/index.tsx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/roleColorEverywhere/index.tsx b/src/plugins/roleColorEverywhere/index.tsx index 090c35d3..7b811943 100644 --- a/src/plugins/roleColorEverywhere/index.tsx +++ b/src/plugins/roleColorEverywhere/index.tsx @@ -156,7 +156,7 @@ export default definePlugin({ find: "#{intl::MESSAGE_EDITED}", replacement: { match: /(?<=isUnsupported\]:(\i)\.isUnsupported\}\),)(?=children:\[)/, - replace: "style:$self.useMessageColorStyle($1)," + replace: "style:$self.useMessageColorsStyle($1)," }, predicate: () => settings.store.colorChatMessages } @@ -188,13 +188,19 @@ export default definePlugin({ }; }, - useMessageColor(message: any) { + useMessageColorsStyle(message: any) { try { const { messageSaturation } = settings.use(["messageSaturation"]); const author = useMessageAuthor(message); if (author.colorString != null && messageSaturation !== 0) { - return `color-mix(in oklab, ${author.colorString} ${messageSaturation}%, var(--text-normal))`; + const value = `color-mix(in oklab, ${author.colorString} ${messageSaturation}%, var({DEFAULT}))`; + + return { + color: value.replace("{DEFAULT}", "--text-normal"), + "--header-primary": value.replace("{DEFAULT}", "--header-primary"), + "--text-muted": value.replace("{DEFAULT}", "--text-muted") + }; } } catch (e) { new Logger("RoleColorEverywhere").error("Failed to get message color", e); @@ -203,14 +209,6 @@ export default definePlugin({ return null; }, - useMessageColorStyle(message: any) { - const color = this.useMessageColor(message); - - return color && { - color - }; - }, - RoleGroupColor: ErrorBoundary.wrap(({ id, count, title, guildId, label }: { id: string; count: number; title: string; guildId: string; label: string; }) => { const role = GuildStore.getRole(guildId, id);