Vendicated / Vencord

The cutest Discord client mod
https://vencord.dev
GNU General Public License v3.0
8.75k stars 1.24k forks source link

add plugin FixHardcodedColors #2663

Open CodeF53 opened 3 months ago

CodeF53 commented 3 months ago

[Depends on utility functions exposed in #2662]

About Plugin

Discord often hardcodes colors despite having css variables for all it's colors.

For example, --primary-160 is #ebedef, but in the code, they have hardcoded the color hex instead of using the variable:

.defaultLightModeCustomGradient_e77fa3 {
    background: linear-gradient(rgba(0,0,0,0) 20%, #ebedef 100%);
}

This causes issues for theme devs who want to make stuff by directly modifying color variables as they need to manually fix all these problems.

This is very prevalent when using ClientTheme and looking at "channels and roles" Discord_tn6oWjipFv

This plugin addresses this issue by generating css to make the problematic code use color variables instead, for example:

.defaultLightModeCustomGradient_e77fa3 {
    background: linear-gradient(rgba(0,0,0,0) 20%, var(--primary-160) 100%);
}