Hi there!
I've learn so much about Sheet Workers, so now I can do the major changes I need.
But I'm stuck with an option for changing the background style color of my character sheet.
I've added a Sheet Worker for this and the code in the CSS file, but the background color doesn't change, like the CSS doesn't take the value of my attribute.
On the HTML page I've added this :
<input class="sheet-mainBgColor" name="attr_mainBgColor" type="hidden" value="default"/>
There is my option butter (inspired by the Ryuutama code for the moment, but I will change that once I get it work)
<label data-i18n="background-color" style="width: 200px;">Background color</label>:
<select name="attr_mainBgColorSelect" value="default">
<option value="default" data-i18n="default" style="background-color: #eeffff;" selected="selected">Default</option>
<option value="white" data-i18n="white" style="background-color: #fff;">White</option>
<option value="lilac" data-i18n="lilac" style="background-color: #fbeeff;">Lilac</option>
<option value="grayscale" data-i18n="grayscale" style="background-color: #f3f3f3;">Grayscale</option>
<option value="book" data-i18n="book" style="background-color: #f3efe6;">Book</option>
<option value="summer" data-i18n="season-summer" style="background-color: #fef7ed;">Summer</option>
<option value="fall" data-i18n="season-fall" style="background-color: #fde7e8;">Fall</option>
<option value="winter" data-i18n="season-winter" style="background-color: #fafefe;">Winter</option>
<option value="spring" data-i18n="season-spring" style="background-color: #f8f9f3;">Spring</option>
</select>
<p data-i18n="backgroundcolordesc">Choose the main color of the character sheet (changes background and headers).</p>
On the HTML Sheet Worker section I've added this :
on("change:mainBgColorSelect", function(event) {
getAttrs(["mainBgColorSelect", "mainBgColor"], function(values) {
setAttrs({
mainBgColor: values.mainBgColorSelect
});
});
});
And in my CSS code, I've added this:
.charsheet {
background-color: var(--main-bg-color);
width: 1000px;
}
.charsheet {
--main-bg-color: #eeffff;
--header-bg-color: #aaeeaa;
--divider-color: lightgray;
--input-bg-color: #fff;
}
.sheet-mainBgColor[value="white"] ~ .sheet-characterSheet { --main-bg-color: #fff; --divider-color: #90939c; }
.sheet-mainBgColor[value="grayscale"] ~ .sheet-characterSheet { --main-bg-color: #f3f3f3; --divider-color: #000; }
.sheet-mainBgColor[value="book"] ~ .sheet-characterSheet { --main-bg-color: #f3efe6; --divider-color: #424242; }
.sheet-mainBgColor[value="summer"] ~ .sheet-characterSheet { --main-bg-color: #fef7ed; --divider-color: #424242; }
.sheet-mainBgColor[value="fall"] ~ .sheet-characterSheet { --main-bg-color: #fde7e8; --divider-color: #cd5142; }
.sheet-mainBgColor[value="winter"] ~ .sheet-characterSheet { --main-bg-color: #fafefe; }
.sheet-mainBgColor[value="spring"] ~ .sheet-characterSheet { --main-bg-color: #f8f9f3; --divider-color: #000; }
.sheet-mainBgColor[Value="lilac"] ~ .sheet-characterSheet { --main-bg-color: #fbeeff; --divider-color: #000; }
I don't really understand where is the step I miss :)
Full code here :
https://github.com/Onirim/Roll20-Rolemaster-2nd-classic
If a kind developer can help!
Thanks :)