Skip to content

Commit

Permalink
3.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorako committed Jun 23, 2024
1 parent 4f9997b commit eaabc3d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
34 changes: 26 additions & 8 deletions esmodules/ui-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}']`
);
}
}
});
}
Expand Down

0 comments on commit eaabc3d

Please sign in to comment.