From eaabc3dd4451c58962e552553bed838ed8c79568 Mon Sep 17 00:00:00 2001 From: Dorako Date: Sun, 23 Jun 2024 10:56:06 +0200 Subject: [PATCH] 3.5.4 --- CHANGELOG.md | 5 +++++ esmodules/ui-theme.js | 34 ++++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66377fa..2322a7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 3.5.4 + +- (Fix) Fixed some log spam in relation to PF2e HUD. +- (Refinement) Expanded the exclusion system so App v2 apps can be excluded via regex (e.g. 'PF2eHud\*'). + # 3.5.3 - (Fix) Fixed an issue where ApplicationV2 dialogs would be illegible using CRB (Light) theme. diff --git a/esmodules/ui-theme.js b/esmodules/ui-theme.js index fda6bf6..69d8051 100644 --- a/esmodules/ui-theme.js +++ b/esmodules/ui-theme.js @@ -93,18 +93,36 @@ for (const appName of [...appV2Apps]) { const { dorakoUiTheme, colorScheme } = uiTheme; const excludeString = game.settings.get("pf2e-dorako-ui", "customization.excluded-applications"); const excludeList = excludeString.split(/[\s,]+/); - if (excludeList.includes(app.constructor.name) || excludedApplications.includes(app.constructor.name)) { - console.debug( - `${MODULE_NAME} | render${app.constructor.name} | is included in excluded applications string ${excludeString} => do not set dorako-ui-theme to ${dorakoUiTheme}` - ); - return; + if (![""].equals(excludeList)) { + for (const excludeElem of excludeList) { + const excludeElemAsRegex = new RegExp(excludeElem); + if (excludeElemAsRegex.test(app.constructor.name)) { + console.debug( + `${MODULE_NAME} | render${app.constructor.name} | matches regex in exclude string ${excludeString} => do not set dorako-ui-theme to ${dorakoUiTheme}` + ); + return; + } + } + if (excludeList.includes(app.constructor.name) || excludedApplications.includes(app.constructor.name)) { + console.debug( + `${MODULE_NAME} | render${app.constructor.name} | is included in excluded applications string ${excludeString} => do not set dorako-ui-theme to ${dorakoUiTheme}` + ); + return; + } } app.element.dataset.theme = dorakoUiTheme; console.debug(`${MODULE_NAME} | render${app.constructor.name} | [data-theme='${dorakoUiTheme}']`); - const subElements = [app.leftElement, app.mainElement, app.menuElement, app.portraitElement]; - for (const subElement of [...subElements]) { - subElement.dataset.theme = dorakoUiTheme; + + // PF2eHudPersistent subelements + const potentialSubElements = ["leftElement", "mainElement", "menuElement", "portraitElement"]; + for (const subElementKey of potentialSubElements) { + if (subElementKey in app) { + app[subElementKey].dataset.theme = dorakoUiTheme; + console.debug( + `${MODULE_NAME} | render${app.constructor.name + "." + subElementKey} | [data-theme='${dorakoUiTheme}']` + ); + } } }); }