export const loadSettings = async function () { game.settings.register("midgard6-lvd", "zauberAlsTag", { name: game.i18n.localize("Midgard6.Settings.zauberAlsTag.name"), hint: game.i18n.localize("Midgard6.Settings.zauberAlsTag.hint"), scope: "user", config: true, default: false, type: Boolean, requiresReload: true }); game.settings.register("midgard6-lvd", "beschreibungChatActive", { name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"), hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"), scope: "client", config: true, default: false, type: Boolean }); game.settings.register("midgard6-lvd", "beschreibungChatActive", { name: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.name"), hint: game.i18n.localize("Midgard6.Settings.beschreibungChatActive.hint"), scope: "client", config: true, default: false, type: Boolean }); game.settings.register("midgard6-lvd", "colorSuccessBg", { name: "Erfolg: Hintergrundfarbe", hint: "Farbe für kritische Erfolge.", scope: "client", config: true, type: String, default: "#5db68b", onChange: () => updateAllCssVariables() }); game.settings.register("midgard6-lvd", "colorFailBg", { name: "Fehlschlag: Hintergrundfarbe", hint: "Farbe für kritische Fehlschläge.", scope: "client", config: true, type: String, default: "#e3e4e5", onChange: () => updateAllCssVariables() }); game.settings.register("midgard6-lvd", "colorCritSuccessBg", { name: "Kritischer Erffolg: Hintergrundfarbe", hint: "Farbe für überdurchschnittliche Würfe.", scope: "client", config: true, type: String, default: "#9de0f0", onChange: () => updateAllCssVariables() }); game.settings.register("midgard6-lvd", "colorCritFailureBg", { name: "Kritischer Erffolg: Hintergrundfarbe", hint: "Farbe für überdurchschnittliche Würfe.", scope: "client", config: true, type: String, default: "#ea7699", onChange: () => updateAllCssVariables() }); }; function updateAllCssVariables() { const root = document.documentElement; const successColor = game.settings.get("midgard6-lvd", "colorSuccessBg"); const failColor = game.settings.get("midgard6-lvd", "colorFailBg"); const critSuccessColor = game.settings.get("midgard6-lvd", "colorCritSuccessBg"); const critFailColor = game.settings.get("midgard6-lvd", "colorCritFailureBg"); root.style.setProperty("--M6-success-color", successColor); root.style.setProperty("--M6-failure-color", failColor); root.style.setProperty("--M6-crit-success-color", critSuccessColor); root.style.setProperty("--M6-crit-failure-color", critFailColor); } Hooks.once("ready", () => { updateAllCssVariables(); });