Skip to content

Commit

Permalink
3.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Dorako committed Nov 10, 2024
1 parent d00da21 commit b4bfda4
Show file tree
Hide file tree
Showing 12 changed files with 295 additions and 214 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 3.7.7

- (Maintenance) Updated selectors for PF2e Chances.
- (Maintenance) Applies either core Foundry .dark-theme or .light-theme classes depending on sheet theme.
- (Refinement) Excluded the PF2e HUD 'note' dialog from styling.
- (New) Added support for the new ABCPicker dialogs.

# 3.7.6

- (Module) Added theme support for PF2e Chances.
Expand Down
6 changes: 3 additions & 3 deletions esmodules/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const premiumModuleSelector = ".preyfordeath, .preyfordeath-wrapper, .cur
/* Apps */
/* ----------------------------------------- */
export const coreApps = ["ImagePopout","SceneControls", "SidebarTab", "PlayerList", "HeadsUpDisplay", "Notifications", "TokenHUD","SceneNavigation", "Hotbar"]; // "Sidebar"
export const systemApps = ["EffectsPanel", "SceneDarknessAdjuster"];
export const systemApps = ["ABCPicker","EffectsPanel", "SceneDarknessAdjuster"];
export const moduleApps = ["MobileUI", "MobileMenu", "WindowMenu","ClockPanel","CoreHUD","HUD","TokenBar", "TokenActionHud","SmallTimeApp","SearchApp","ControlManager","HUD","ItemPileConfig","PinCushionHUD","CommonToolbar","MonksHotbarExpansion","CustomHotbar"];
export const appV2Apps = ["PF2eHudSidebar","PF2eHudToken","PF2eHudTooltip","PF2eHudPersistent","PF2eHudTracker"];
export const themedApps = [...coreApps, ...systemApps, ...moduleApps];
Expand All @@ -21,10 +21,10 @@ export const themedApps = [...coreApps, ...systemApps, ...moduleApps];
/* ----------------------------------------- */
export const systemSheets = ["ArmySheetPF2e","CreatureSheetPF2e","PartySheetPF2e","SpellPreparationSheet","ItemSheet","NPCSheetPF2e","VehicleSheetPF2e","FamiliarSheetPF2e","HazardSheetPF2e", "CharacterSheetPF2e","LootSheetPF2e"]; //|| "ItemSheet","ActorSheet", "KingdomSheetPF2e"
export const moduleWindowApps = ["ExtendedSettingsConfig"];
export const limitedScopeApplications = ["RolodexApplication","ArmySheetPF2e","KingdomSheetPF2e","CreatureSheetPF2e", "CharacterSheetPF2e", "PartySheetPF2e", "NPCSheetPF2e", "HazardSheetPF2e","VehicleSheetPF2e", "HUD"];
export const limitedScopeApplications = ["ABCPicker","RolodexApplication","ArmySheetPF2e","KingdomSheetPF2e","CreatureSheetPF2e", "CharacterSheetPF2e", "PartySheetPF2e", "NPCSheetPF2e", "HazardSheetPF2e","VehicleSheetPF2e", "HUD"];
export const unlimitedScopeApplications = ["PlaylistDirectory"];

/* ----------------------------------------- */
/* Excluded */
/* ----------------------------------------- */
export const excludedApplications = ["PF2EBestiary","SigilPF2EAdventureImporter","PreyJournalSheet","PF2eHudItemPopup","ItemAnimationsApp","ActorAnimationsApp","AnimationHistoryApp", "UserAnimationsApp", "WorldAnimationsApp","JSONEditorApp", "VCEChatLog", "AutorecMenuApp","GmScreenApplicationDrawer","MixerApp","EnhancedJournal","PartyOverviewApp","KingdomBuilder","ChatLogPF2e","ItemMenuApp","LevelsUI", "SpecialEffectsManagement", "ParticleEffectsManagement", "FilterEffectsManagementConfig"]; //
export const excludedApplications = ["PF2EBestiary","SigilPF2EAdventureImporter","PreyJournalSheet","PF2eHudTextPopup","PF2eHudItemPopup","ItemAnimationsApp","ActorAnimationsApp","AnimationHistoryApp", "UserAnimationsApp", "WorldAnimationsApp","JSONEditorApp", "VCEChatLog", "AutorecMenuApp","GmScreenApplicationDrawer","MixerApp","EnhancedJournal","PartyOverviewApp","KingdomBuilder","ChatLogPF2e","ItemMenuApp","LevelsUI", "SpecialEffectsManagement", "ParticleEffectsManagement", "FilterEffectsManagementConfig"]; //
12 changes: 12 additions & 0 deletions esmodules/misc-hooks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
import { MODULE_NAME, systemSheets } from "./consts.js";
import { lookupThemeAndSchemeForKey } from "./ui-theme.js";
import { i18n, debug, warn } from "./util.js";

Hooks.once("ready", () => {
const theme = game.settings.get("pf2e-dorako-ui", "theme.window-app-theme");
if (theme === "no-theme") return;
document.body.classList.remove("theme-light");
document.body.classList.remove("theme-dark");

const uiTheme = lookupThemeAndSchemeForKey(theme);
const { dorakoUiTheme, colorScheme } = uiTheme;
document.body.classList.add("theme-" + colorScheme);
});

Hooks.once("ready", () => {
if (!game.modules.get("pf2e-dorako-ux")) return;
if (game.modules.get("pf2e-dorako-ux")?.active) return;
Expand Down
103 changes: 54 additions & 49 deletions esmodules/ui-theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export function lookupThemeAndSchemeForKey(key) {
}

Hooks.on("renderSvelteApplication", (app, html, data) => {
const theme = game.settings.get("pf2e-dorako-ui", "theme.window-app-theme");
const theme = themedApps.includes(app.constructor.name)
? game.settings.get("pf2e-dorako-ui", "theme.app-theme")
: game.settings.get("pf2e-dorako-ui", "theme.window-app-theme");
if (theme === "no-theme") return;
const uiTheme = lookupThemeAndSchemeForKey(theme);
if (uiTheme === null) return;
Expand All @@ -59,9 +61,10 @@ Hooks.on("renderSvelteApplication", (app, html, data) => {
return;
}
const { dorakoUiTheme, colorScheme } = uiTheme;
app.element[0].dataset.theme = dorakoUiTheme;
app.element[0].dataset.colorScheme = colorScheme;
app.element[0].dataset.dorakoUiScope = "unlimited";
const elem = app.element instanceof jQuery ? app.element[0] : app.element;
elem.dataset.theme = dorakoUiTheme;
if (colorScheme != null) elem.dataset.colorScheme = colorScheme;
// elem.dataset.dorakoUiScope = "unlimited";
});

// Interface theme
Expand All @@ -80,8 +83,8 @@ for (const appName of [...themedApps]) {
);
return;
}

app.element[0].dataset.theme = dorakoUiTheme;
const elem = app.element instanceof jQuery ? app.element[0] : app.element;
elem.dataset.theme = dorakoUiTheme;
console.debug(`${MODULE_NAME} | render${app.constructor.name} | [data-theme='${dorakoUiTheme}']`);
});
}
Expand Down Expand Up @@ -121,7 +124,7 @@ for (const appName of [...appV2Apps]) {
if (appName === "PF2eHudPersistent") {
const potentialSubElements = ["leftElement", "mainElement", "menuElement", "portraitElement", "effectsElement"];
for (const subElementKey of potentialSubElements) {
if (subElementKey in app) {
if (subElementKey in app && app[subElementKey] != null) {
app[subElementKey].dataset.theme = dorakoUiTheme;
console.debug(
`${MODULE_NAME} | render${app.constructor.name + "." + subElementKey} | [data-theme='${dorakoUiTheme}']`
Expand Down Expand Up @@ -230,48 +233,49 @@ Hooks.on("renderApplication", (app, html, data) => {
}
});

Hooks.on("renderApplicationV2", (app, html, data) => {
if (html.classList.contains("editable")) return;
if (!html.classList.contains("application")) return;
// if (isPremiumApplication(app, html, data, app.constructor.name)) return;
const theme = game.settings.get("pf2e-dorako-ui", "theme.window-app-theme");
if (theme === "no-theme") return;
const uiTheme = lookupThemeAndSchemeForKey(theme);
if (uiTheme === null) return;
const { dorakoUiTheme, colorScheme } = uiTheme;
const excludeString =
game.settings.get("pf2e-dorako-ui", "customization.excluded-applications") +
", EnhancedJournal" +
", SceneActorsLayer" +
", SmallTimeApp" +
", SceneDarknessAdjuster" +
", AutorecMenuApp" +
", ImagePopout" +
", PF2eHudResources";
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;
}
// Hooks.on("renderApplicationV2", (app, html, data) => {
// if (html.classList.contains("editable")) return;
// if (!html.classList.contains("application")) return;
// // if (isPremiumApplication(app, html, data, app.constructor.name)) return;
// const theme = game.settings.get("pf2e-dorako-ui", "theme.window-app-theme");
// if (theme === "no-theme") return;
// const uiTheme = lookupThemeAndSchemeForKey(theme);
// if (uiTheme === null) return;
// const { dorakoUiTheme, colorScheme } = uiTheme;
// const excludeString =
// game.settings.get("pf2e-dorako-ui", "customization.excluded-applications") +
// ", EnhancedJournal" +
// ", SceneActorsLayer" +
// ", SmallTimeApp" +
// ", SceneDarknessAdjuster" +
// ", AutorecMenuApp" +
// ", ImagePopout" +
// ", PF2eHudResources";
// 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;
// }

const fakeDialogPatterns = ["popup", "dialog"];
for (const fakeDialogPattern of [...fakeDialogPatterns]) {
if (app.constructor.name.toLowerCase().includes(fakeDialogPattern)) {
console.debug(
`${MODULE_NAME} | render${app.constructor.name} | constructor includes '${fakeDialogPattern}' => add .dialog`
);
// html.addClass("dialog");
}
}
app.element.dataset.theme = dorakoUiTheme;
app.element.dataset.colorScheme = colorScheme;
app.element.dataset.dorakoUiScope = "unlimited";
console.debug(
`${MODULE_NAME} | render${app.constructor.name} | [data-theme='${dorakoUiTheme}'] [data-color-scheme='${colorScheme}'] [data-dorako-ui-scope='unlimited']`
);
});
// const fakeDialogPatterns = ["popup", "dialog"];
// for (const fakeDialogPattern of [...fakeDialogPatterns]) {
// if (app.constructor.name.toLowerCase().includes(fakeDialogPattern)) {
// console.debug(
// `${MODULE_NAME} | render${app.constructor.name} | constructor includes '${fakeDialogPattern}' => add .dialog`
// );
// // html.addClass("dialog");
// }
// }
// const elem = app.element instanceof jQuery ? app.element[0] : app.element;
// elem.dataset.theme = dorakoUiTheme;
// elem.dataset.colorScheme = colorScheme;
// // elem.dataset.dorakoUiScope = "unlimited";
// console.debug(
// `${MODULE_NAME} | render${app.constructor.name} | [data-theme='${dorakoUiTheme}'] [data-color-scheme='${colorScheme}'] [data-dorako-ui-scope='unlimited']`
// );
// });

for (const appName of [...limitedScopeApplications]) {
Hooks.on("render" + appName, (app, html, data) => {
Expand All @@ -288,7 +292,8 @@ for (const appName of [...limitedScopeApplications]) {
return;
}
console.debug(`${MODULE_NAME} | render${app.constructor.name} | [data-ui-scope='limited']`);
app.element[0].dataset.dorakoUiScope = "limited";
const elem = app.element instanceof jQuery ? app.element[0] : app.element;
elem.dataset.dorakoUiScope = "limited";
});
}

Expand Down
4 changes: 2 additions & 2 deletions esmodules/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ export function getPlayerOwners(actor) {
// If "nobody" owns it, whoever is the primaryUpdater (read: GM) does.
// This should handle weirdos like { ownership: { default: 0 } }
if (actor.primaryUpdater) {
log("Could not determine owner, defaulting to primaryUpdater.");
// log("Could not determine owner, defaulting to primaryUpdater.");
return [actor.primaryUpdater];
} else {
log("Could not determine owner nor found the primaryUpdater, defaulting to all GMs.");
// log("Could not determine owner nor found the primaryUpdater, defaulting to all GMs.");
return game.users.filter((x) => x.isGM);
}
}
Expand Down
9 changes: 4 additions & 5 deletions sass/module-support/_pf2e-chances.scss
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
[data-theme] {
.pf2e-chances-chatcard-container {
background: none !important;
outline: none !important;
}
}

[data-theme][data-color-scheme="dark"] {
.pf2e-chances-chatcard-line.critical-failure {
.pf2e-chances-chatcard-bar.critical-failure {
color: var(--degree-failure-critical);
}

.pf2e-chances-chatcard-line.failure {
.pf2e-chances-chatcard-bar.failure {
color: var(--degree-failure);
}

.pf2e-chances-chatcard-line.success {
.pf2e-chances-chatcard-bar.success {
color: var(--degree-success);
}

.pf2e-chances-chatcard-line.critical-success {
.pf2e-chances-chatcard-bar.critical-success {
color: var(--degree-success-critical);
}
}
21 changes: 12 additions & 9 deletions sass/ui-theme/foundry-core/_app-ui.scss
Original file line number Diff line number Diff line change
Expand Up @@ -318,28 +318,28 @@
/* Generalized style choices (exlusive of limited scope) */
/* ------------------------------------------------------------ */

[data-theme][data-dorako-ui-scope="unlimited"][data-color-scheme="dark"] {
[data-theme][data-color-scheme="dark"]:not([data-dorako-ui-scope="limited"]) {
h1 {
color: var(--text-color-1);
color: var(--color-text-primary);
}
h2 {
color: var(--text-color-1);
color: var(--color-text-primary);
}
h3 {
color: var(--text-color-1);
color: var(--color-text-primary);
}
h4:not([data-visibility]) {
color: var(--text-color-2);
color: var(--color-text-secondary);
}
h5 {
color: var(--text-color-2);
color: var(--color-text-secondary);
}
h6 {
color: var(--text-color-2);
color: var(--color-text-secondary);
}
}

[data-theme][data-dorako-ui-scope="unlimited"] {
[data-theme]:not([data-dorako-ui-scope="limited"]) {
// color: var(--text-color-3);

input[type="text"],
Expand Down Expand Up @@ -487,7 +487,7 @@
body.game [data-theme].window-app,
body.game [data-theme].application {
// --background: url(../ui/parchment.jpg) repeat;
// --color-text-primary: var(--color-text-secondary);
--color-text-primary: var(--text-color-2);
--color-header-background: var(--text-color-3);
--color-fieldset-border: var(--text-color-2);
// color-text-primary is a core variable
Expand Down Expand Up @@ -551,9 +551,12 @@ body.game [data-theme].application {
// Electron app bug
box-shadow: var(--window-app-box-shadow);

&.abc-picker,
&.sidebar-popout {
border: var(--app-border-width) solid var(--window-app-border-color);
box-shadow: var(--box-shadow);
backdrop-filter: blur(5px);
--color-text-dark-secondary: #a89d8b;
}

.window-header {
Expand Down
6 changes: 6 additions & 0 deletions sass/ui-theme/pf2e-system/_party-sheet.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[data-theme][data-dorako-ui-scope="limited"] {
&[data-color-scheme="dark"] {
&.sheet.party [data-tab="overview"] .member > .data header .resource .empty {
border-color: #b9ae78;
}
}

&.sheet.party {
--color-border: var(--color-primary-3);
--alt-dark: var(--text-color-4);
Expand Down
7 changes: 7 additions & 0 deletions sass/ui-theme/pf2e-system/_pc-sheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@
--color-text-dark-4: var(--text-color-4);
--color-text-dark-3: var(--text-color-5);
--color-text-dark-2: var(--text-color-2);
--color-text-dark-inactive: var(--text-color-disabled);
// .tag,
.value,
.label,
Expand Down Expand Up @@ -659,6 +660,12 @@
}
}

[data-theme] {
&.abc-picker input[type="search"] {
@include dui-input;
}
}

[data-theme] {
&.attribute-builder .window-content .title {
--primary: var(--accent-color);
Expand Down
2 changes: 1 addition & 1 deletion sass/ui-theme/themes/_crb-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* ----------------------------------------- */
/* Unlimited */
/* ----------------------------------------- */
[data-theme^="crb"][data-color-scheme="dark"][data-dorako-ui-scope="unlimited"] {
[data-theme^="crb"][data-color-scheme="dark"]:not([data-dorako-ui-scope="limited"]) {
.tagify,
select,
input,
Expand Down
Loading

0 comments on commit b4bfda4

Please sign in to comment.