mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 22:53:02 -04:00
Fix IrcColors for gradient roles and other patches
This commit is contained in:
parent
690574376b
commit
92ff9c1ca4
3 changed files with 15 additions and 5 deletions
|
@ -197,7 +197,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
// Patches Discord generic logger function
|
// Patches Discord generic logger function
|
||||||
{
|
{
|
||||||
find: "Σ:",
|
find: '"file-only"!==',
|
||||||
predicate: () => settings.store.disableLoggers,
|
predicate: () => settings.store.disableLoggers,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=&&)(?=console)/,
|
match: /(?<=&&)(?=console)/,
|
||||||
|
|
|
@ -66,8 +66,10 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: '="SYSTEM_TAG"',
|
find: '="SYSTEM_TAG"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=\.username.{0,50}?)style:/,
|
// Override colorString with our custom color and disable gradients if applying the custom color.
|
||||||
replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:"
|
match: /&&null!=\i\.secondaryColor,(?<=colorString:(\i).+?(\i)=.+?)/,
|
||||||
|
replace: (m, colorString, hasGradientColors) => `${m}` +
|
||||||
|
`vcIrcColorsDummy=[${colorString},${hasGradientColors}]=$self.getMessageColorsVariables(arguments[0],${hasGradientColors}),`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -80,6 +82,13 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
getMessageColorsVariables(context: any, hasGradientColors: boolean) {
|
||||||
|
const colorString = this.calculateNameColorForMessageContext(context);
|
||||||
|
const originalColorString = context?.author?.colorString;
|
||||||
|
|
||||||
|
return [colorString, hasGradientColors && colorString === originalColorString];
|
||||||
|
},
|
||||||
|
|
||||||
calculateNameColorForMessageContext(context: any) {
|
calculateNameColorForMessageContext(context: any) {
|
||||||
const userId: string | undefined = context?.message?.author?.id;
|
const userId: string | undefined = context?.message?.author?.id;
|
||||||
const colorString = context?.author?.colorString;
|
const colorString = context?.author?.colorString;
|
||||||
|
@ -97,6 +106,7 @@ export default definePlugin({
|
||||||
? color
|
? color
|
||||||
: colorString;
|
: colorString;
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateNameColorForListContext(context: any) {
|
calculateNameColorForListContext(context: any) {
|
||||||
const id = context?.user?.id;
|
const id = context?.user?.id;
|
||||||
const colorString = context?.colorString;
|
const colorString = context?.colorString;
|
||||||
|
|
|
@ -126,8 +126,8 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
// Make the tab bar item text smaller so our tab can fit.
|
// Make the tab bar item text smaller so our tab can fit.
|
||||||
{
|
{
|
||||||
match: /(\.tabBarItem.+?variant:)"heading-lg\/medium"/,
|
match: /(\.tabBarItem.+?variant:)"heading-md\/normal"/,
|
||||||
replace: '$1"heading-sm/medium"'
|
replace: '$1"heading-sm/normal"'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue