mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
Styles, BlurNSFW: update Style["variables"] type to support number values
This commit is contained in:
parent
a2785628c6
commit
7948f943de
2 changed files with 4 additions and 4 deletions
|
@ -24,7 +24,7 @@ export interface Style {
|
|||
name: string;
|
||||
source: string;
|
||||
enabled: boolean;
|
||||
variables?: Record<string, string>;
|
||||
variables?: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export function requireStyle(name: string) {
|
||||
|
@ -177,7 +177,7 @@ export function updateStyleInDocument(style: Style, doc: Document) {
|
|||
if (style.variables) {
|
||||
Object.entries(style.variables).forEach(([key, value]) => {
|
||||
const kebabCaseKey = key.replaceAll(/(?<=[a-z])[A-Z0-9]/g, v => `-${v}`).toLowerCase();
|
||||
content = content.replaceAll(`[--${kebabCaseKey}]`, value);
|
||||
content = content.replaceAll(`[--${kebabCaseKey}]`, value.toString());
|
||||
});
|
||||
}
|
||||
styleElement.textContent = content;
|
||||
|
|
|
@ -44,13 +44,13 @@ export default definePlugin({
|
|||
description: "Blur Amount",
|
||||
default: 10,
|
||||
onChange(v) {
|
||||
setStyleVariables(style, { blurAmount: v.toString() });
|
||||
setStyleVariables(style, { blurAmount: v });
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
start() {
|
||||
setStyleVariables(style, { blurAmount: this.settings.store.blurAmount.toString() });
|
||||
setStyleVariables(style, { blurAmount: this.settings.store.blurAmount });
|
||||
},
|
||||
|
||||
style
|
||||
|
|
Loading…
Add table
Reference in a new issue