From 69ad255cba7ea3124b075b7fe5d75ba52925fa2b Mon Sep 17 00:00:00 2001 From: Etorix <92535668+EtorixDev@users.noreply.github.com> Date: Mon, 23 Feb 2026 19:39:57 -0800 Subject: [PATCH] SMYN: Fix mention color for default role color. (#832) --- src/plugins/showMeYourName/index.tsx | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 7c8e24582..8b5c8a57b 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -20,7 +20,7 @@ import { classNameFactory, ModalCloseButton, ModalContent, ModalFooter, ModalHea import definePlugin, { OptionType } from "@utils/types"; import { GuildMember, Message, User } from "@vencord/discord-types"; import { findByCodeLazy, findStoreLazy } from "@webpack"; -import { ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common"; +import { ChannelStore, GuildMemberStore, GuildRoleStore, GuildStore, Menu, MessageStore, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common"; import { JSX } from "react"; const SMYNC = classNameFactory(); @@ -480,7 +480,9 @@ function renderUsername( const ircColorsEnabled = isPluginEnabled(ircColors.name); - const authorColorStrings = colorStrings || (author as any)?.colorStrings || null; + const authorTopRole = (author as GuildMember)?.guildId && (author as any)?.highestRoleId; + const authorTopRoleColor = authorTopRole && GuildRoleStore.getRole((author as GuildMember).guildId, authorTopRole)?.colorStrings; + const authorColorStrings = colorStrings || (author as any)?.colorStrings || authorTopRoleColor || null; const authorDisplayNameStyles = (!inGuild && !ircColorsEnabled && (author as any)?.displayNameStyles) || null; const effectType = authorDisplayNameStyles ? getEffectType(authorDisplayNameStyles.effectId) : null; const effectCSSVars = authorDisplayNameStyles ? computeEffectCSSVars(authorDisplayNameStyles) : {}; @@ -490,9 +492,9 @@ function renderUsername( const shouldAnimateEffect = shouldShowEffect && !AccessibilityStore.useReducedMotion; const canUseGradient = ((author as GuildMember)?.guildId ? (GuildStore.getGuild((author as GuildMember).guildId) ?? {}).premiumFeatures?.features.includes("ENHANCED_ROLE_COLORS") : !inGuild); - const useTopRoleStyle = isMention || isReactionsPopout || channel?.isDM() || channel?.isGroupDM(); - const topRoleStyle = author ? resolveColor(authorColorStrings, authorDisplayNameStyles, "Role", canUseGradient, inGuild, ircColorsEnabled, isHovering) : null; - const hasGradient = !!topRoleStyle?.gradient && Object.keys(topRoleStyle.gradient).length > 0; + const useTopStyle = isMention || isReactionsPopout || channel?.isDM() || channel?.isGroupDM(); + const topStyle = author ? resolveColor(authorColorStrings, authorDisplayNameStyles, "Role", canUseGradient, inGuild, ircColorsEnabled, isHovering) : null; + const hasGradient = !!topStyle?.gradient && Object.keys(topStyle.gradient).length > 0; const textMutedValue = getComputedStyle(document.documentElement)?.getPropertyValue("--text-muted")?.trim() || "#72767d"; const options = splitTemplate(includedNames); @@ -647,7 +649,7 @@ function renderUsername( // Only mentions and reactions popouts should patch in the gradient glow or else a double glow will appear on messages. const hoveringClass = (isHovering ? " smyn-gradient-hovered" : ""); - const gradientClasses = useTopRoleStyle + const gradientClasses = useTopStyle ? "smyn-gradient smyn-gradient-inherit-bg" + hoveringClass : "smyn-gradient smyn-gradient-unset-bg" + hoveringClass; @@ -679,7 +681,7 @@ function renderUsername( @@ -688,7 +690,7 @@ function renderUsername( {first.wrapped}