remove unused setting and fix css gradient custom themes, 1.1.1
This commit is contained in:
parent
70929ef693
commit
3a2e6bddb0
2 changed files with 34 additions and 24 deletions
|
|
@ -91,7 +91,7 @@ Hooks.once('init', () => {
|
|||
|
||||
game.settings.register(MODULE_ID, 'fullColor', {
|
||||
name: 'Full Icon Color',
|
||||
hint: 'CSS color string or gradient (Used if Theme is Custom).',
|
||||
hint: 'CSS color string or gradient (e.g., "linear-gradient(90deg, red, blue)"). Used if Theme is Custom.',
|
||||
scope: 'client',
|
||||
config: true,
|
||||
type: String,
|
||||
|
|
@ -99,16 +99,6 @@ Hooks.once('init', () => {
|
|||
onChange: refreshFearTracker
|
||||
});
|
||||
|
||||
game.settings.register(MODULE_ID, 'emptyColor', {
|
||||
name: 'Empty Icon Color',
|
||||
hint: 'CSS color string for inactive icons (Used if Theme is Custom).',
|
||||
scope: 'client',
|
||||
config: true,
|
||||
type: String,
|
||||
default: '#444444',
|
||||
onChange: refreshFearTracker
|
||||
});
|
||||
|
||||
game.settings.register(MODULE_ID, 'trackerScale', {
|
||||
name: 'Tracker Scale',
|
||||
hint: 'Resize the fear tracker (0.25x to 2.0x).',
|
||||
|
|
@ -186,15 +176,12 @@ Hooks.on('renderSettingsConfig', (app, html, data) => {
|
|||
|
||||
// Color Inputs
|
||||
const fullColorGroup = findGroup('fullColor');
|
||||
const emptyColorGroup = findGroup('emptyColor');
|
||||
|
||||
if (fullColorGroup && emptyColorGroup) {
|
||||
if (fullColorGroup) {
|
||||
if (theme === 'custom') {
|
||||
fullColorGroup.show();
|
||||
emptyColorGroup.show();
|
||||
} else {
|
||||
fullColorGroup.hide();
|
||||
emptyColorGroup.hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -349,7 +336,7 @@ function injectFearCustomization(html) {
|
|||
const customIcon = game.settings.get(MODULE_ID, 'customIcon');
|
||||
const colorTheme = game.settings.get(MODULE_ID, 'colorTheme');
|
||||
let fullColor = game.settings.get(MODULE_ID, 'fullColor');
|
||||
let emptyColor = game.settings.get(MODULE_ID, 'emptyColor');
|
||||
let emptyColor = '#444444'; // Default for custom
|
||||
|
||||
// Theme Data for Interpolation
|
||||
let themeStart = null;
|
||||
|
|
@ -446,16 +433,42 @@ function injectFearCustomization(html) {
|
|||
if (colorTheme !== 'foundryborne') {
|
||||
if (isInactive) {
|
||||
icon.style.background = emptyColor;
|
||||
icon.style.backgroundSize = 'cover'; // Reset size for empty
|
||||
icon.style.backgroundPosition = 'center'; // Reset pos for empty
|
||||
} else {
|
||||
// Active
|
||||
if (themeStart && themeEnd && totalIcons > 1) {
|
||||
// Interpolate
|
||||
// Interpolate (Preset Themes)
|
||||
const factor = index / (totalIcons - 1);
|
||||
const color = interpolateColor(themeStart, themeEnd, factor);
|
||||
icon.style.background = color;
|
||||
icon.style.backgroundSize = 'cover';
|
||||
icon.style.backgroundPosition = 'center';
|
||||
} else {
|
||||
// Custom or Single Color
|
||||
icon.style.background = fullColor;
|
||||
// Custom Theme
|
||||
// Check if fullColor appears to be a gradient
|
||||
const isGradient = fullColor.includes('gradient');
|
||||
|
||||
if (isGradient && totalIcons > 0) {
|
||||
icon.style.background = fullColor;
|
||||
icon.style.backgroundSize = `${totalIcons * 100}% 100%`;
|
||||
|
||||
// Calculate position
|
||||
// Leftmost (index 0) = 0%
|
||||
// Rightmost (index total-1) = 100%
|
||||
let pos = 0;
|
||||
if (totalIcons > 1) {
|
||||
pos = (index / (totalIcons - 1)) * 100;
|
||||
}
|
||||
|
||||
icon.style.backgroundPosition = `${pos}% 0%`;
|
||||
icon.style.backgroundAttachment = 'local'; // Ensure it sticks to the specific element config if needed, though default is usually fine.
|
||||
} else {
|
||||
// Solid Color
|
||||
icon.style.background = fullColor;
|
||||
icon.style.backgroundSize = 'cover';
|
||||
icon.style.backgroundPosition = 'center';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -469,9 +482,6 @@ function injectFearCustomization(html) {
|
|||
const animateMax = game.settings.get(MODULE_ID, 'maxFearAnimation');
|
||||
if (animateMax) {
|
||||
// Check if all available icons are active
|
||||
// Icons are "active" if they don't have the 'inactive' class.
|
||||
// Wait, looking at the code above, 'inactive' class checks are used.
|
||||
// Let's count totals.
|
||||
const activeIcons = Array.from(icons).filter(icon => !icon.classList.contains('inactive')).length;
|
||||
|
||||
// If totalIcons > 0 and activeIcons === totalIcons, apply animation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue