customUserColors: fix color dm list (#176)
Some checks are pending
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

This commit is contained in:
mochie 2025-03-06 23:14:41 +01:00 committed by GitHub
parent c93e74ec0c
commit 722e2b99c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,16 +92,30 @@ export default definePlugin({
}, },
{ {
predicate: () => settings.store.dmList, predicate: () => settings.store.dmList,
find: "!1,wrapContent", find: "PrivateChannel.renderAvatar",
replacement: { replacement: {
match: /(nameAndDecorators,)/, match: /(highlighted:\i,)/,
replace: "$1style:{color:$self.colorDMList(arguments[0])}," replace: "$1style:{color:`${$self.colorDMList(arguments[0])}`},"
}, },
}, },
{
predicate: () => settings.store.dmList,
find: "!1,wrapContent",
replacement: [
{
match: /(innerClassName:\i)(\}=\i)/,
replace: "$1,style$2"
},
{
match: /(nameAndDecorators,)/,
replace: "$1style,"
},
],
},
], ],
colorDMList(a: any): string | undefined { colorDMList(a: any): string | undefined {
const userId = a?.subText?.props?.user?.id; const userId = a?.user?.id;
if (!userId) return; if (!userId) return;
const colorString = getCustomColorString(userId, true); const colorString = getCustomColorString(userId, true);
if (colorString) return colorString; if (colorString) return colorString;