diff --git a/src/equicordplugins/customUserColors/SetColorModal.tsx b/src/equicordplugins/customUserColors/SetColorModal.tsx
index ba979da67..2fdf260ce 100644
--- a/src/equicordplugins/customUserColors/SetColorModal.tsx
+++ b/src/equicordplugins/customUserColors/SetColorModal.tsx
@@ -14,8 +14,8 @@ import { colors, DATASTORE_KEY } from "./index";
const cl = classNameFactory("vc-customColors-");
-export function SetColorModal({ userId, modalProps }: { userId: string, modalProps: ModalProps; }) {
- const initialColor = parseInt(colors[userId], 16) || 372735;
+export function SetColorModal({ id, modalProps }: { id: string, modalProps: ModalProps; }) {
+ const initialColor = parseInt(colors[id], 16) || 372735;
// color picker default to current color set for user (if null it's 0x05afff :3 )
const [colorPickerColor, setColorPickerColor] = useState(initialColor);
@@ -32,13 +32,13 @@ export function SetColorModal({ userId, modalProps }: { userId: string, modalPro
}
async function saveUserColor() {
- colors[userId] = colorPickerColor.toString(16).padStart(6, "0");
+ colors[id] = colorPickerColor.toString(16).padStart(6, "0");
await set(DATASTORE_KEY, colors);
modalProps.onClose();
}
async function deleteUserColor() {
- delete colors[userId];
+ delete colors[id];
await set(DATASTORE_KEY, colors);
modalProps.onClose();
}
diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx
index 9efc00684..b09bd0b9a 100644
--- a/src/equicordplugins/customUserColors/index.tsx
+++ b/src/equicordplugins/customUserColors/index.tsx
@@ -12,9 +12,9 @@ import { definePluginSettings, Settings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { User } from "@vencord/discord-types";
+import { Channel, User } from "@vencord/discord-types";
import { extractAndLoadChunksLazy } from "@webpack";
-import { Menu } from "@webpack/common";
+import { ChannelStore, Menu, SelectedChannelStore } from "@webpack/common";
import { SetColorModal } from "./SetColorModal";
@@ -52,20 +52,37 @@ const userContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: {
icon={ColorIcon}
action={async () => {
await requireSettingsMenu();
- openModal(modalProps => );
+ openModal(modalProps => );
}}
/>
);
children.push(
, setCustomColorItem);
-
};
-export function getCustomColorString(userId: string | undefined, withHash?: boolean): string | undefined {
- if (!userId) return;
- if (!colors[userId] || !Settings.plugins.CustomUserColors.enabled) return;
- if (withHash) return `#${colors[userId]}`;
- return colors[userId];
+const channelContextMenuPatch: NavContextMenuPatchCallback = (children, { channel }: { channel: Channel; }) => {
+ if (channel?.id == null) return;
+
+ const setCustomColorItem = (
+ {
+ await requireSettingsMenu();
+ openModal(modalProps => );
+ }}
+ />
+ );
+
+ children.push(, setCustomColorItem);
+};
+
+export function getCustomColorString(id: string | undefined, withHash?: boolean): string | undefined {
+ if (!id) return;
+ if (!colors[id] || !Settings.plugins.CustomUserColors.enabled) return;
+ if (withHash) return `#${colors[id]}`;
+ return colors[id];
}
const settings = definePluginSettings({
@@ -85,7 +102,10 @@ export default definePlugin({
name: "CustomUserColors",
description: "Lets you add a custom color to any user, anywhere! Highly recommend to use with typingTweaks and roleColorEverywhere",
authors: [EquicordDevs.mochienya],
- contextMenus: { "user-context": userContextMenuPatch },
+ contextMenus: {
+ "user-context": userContextMenuPatch,
+ "gdm-context": channelContextMenuPatch,
+ },
settings,
requireSettingsMenu,
getCustomColorString,
@@ -135,10 +155,12 @@ export default definePlugin({
wrapMessageColorProps(colorProps: { colorString: string, colorStrings?: Record<"primaryColor" | "secondaryColor" | "tertiaryColor", string>; }, context: any) {
try {
+ const channelId = SelectedChannelStore.getChannelId();
+ const channel = ChannelStore.getChannel(channelId);
+ const isDM = channel.isDM() || channel.isMultiUserDM();
const colorString = this.colorIfServer(context);
- if (colorString === colorProps.colorString) {
- return colorProps;
- }
+ if (colorString === colorProps.colorString) return colorProps;
+ if (!settings.store.colorInServers && !isDM) return colorProps;
return {
...colorProps,
@@ -156,8 +178,9 @@ export default definePlugin({
},
colorDMList(context: any): string | undefined {
- const userId = context?.user?.id;
- const colorString = getCustomColorString(userId, true);
+ const id = context?.user?.id ?? context?.channel?.id;
+ const colorString = getCustomColorString(id, true);
+
return colorString ?? "inherit";
},
diff --git a/src/plugins/_api/badges/index.tsx b/src/plugins/_api/badges/index.tsx
index 7ea3a61f5..4423b69a3 100644
--- a/src/plugins/_api/badges/index.tsx
+++ b/src/plugins/_api/badges/index.tsx
@@ -142,10 +142,10 @@ export default definePlugin({
]
},
{
- find: "profileCardUsernameRow,children",
+ find: "profileCardUsernameRow,children:",
replacement: {
- match: /(?<=displayProfile:(\i).+?badges:)(\i)/,
- replace: "[...$self.getBadges($1),...$2]"
+ match: /badges:(\i)(?<=displayProfile:(\i).+?)/,
+ replace: "badges:[...$self.getBadges($2),...$1]"
}
}
],