mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-09 14:43:03 -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
|
||||
{
|
||||
find: "Σ:",
|
||||
find: '"file-only"!==',
|
||||
predicate: () => settings.store.disableLoggers,
|
||||
replacement: {
|
||||
match: /(?<=&&)(?=console)/,
|
||||
|
|
|
@ -66,8 +66,10 @@ export default definePlugin({
|
|||
{
|
||||
find: '="SYSTEM_TAG"',
|
||||
replacement: {
|
||||
match: /(?<=\.username.{0,50}?)style:/,
|
||||
replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:"
|
||||
// Override colorString with our custom color and disable gradients if applying the custom color.
|
||||
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) {
|
||||
const userId: string | undefined = context?.message?.author?.id;
|
||||
const colorString = context?.author?.colorString;
|
||||
|
@ -97,6 +106,7 @@ export default definePlugin({
|
|||
? color
|
||||
: colorString;
|
||||
},
|
||||
|
||||
calculateNameColorForListContext(context: any) {
|
||||
const id = context?.user?.id;
|
||||
const colorString = context?.colorString;
|
||||
|
|
|
@ -126,8 +126,8 @@ export default definePlugin({
|
|||
},
|
||||
// Make the tab bar item text smaller so our tab can fit.
|
||||
{
|
||||
match: /(\.tabBarItem.+?variant:)"heading-lg\/medium"/,
|
||||
replace: '$1"heading-sm/medium"'
|
||||
match: /(\.tabBarItem.+?variant:)"heading-md\/normal"/,
|
||||
replace: '$1"heading-sm/normal"'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue