The night-market demo changed two visual details by setting one custom property. A ceramics workshop card now needs an optional plum accent and a way to restore the stylesheet's teal default.
A CSS custom property starts with two hyphens, like --accent. A declaration such as border-color: var(--accent) looks up the effective value. element.style.setProperty("--accent", "#hex") changes the value inline on that element, so descendants can inherit it. element.style.removeProperty("--accent") removes the inline value and exposes the value declared in style.css again. Do not replace a class or entire style attribute merely to change one shared variable.
Here is a separate reading-room shelf example. Its selectors, value, and text are not your workshop answer:
const shelf = document.querySelector("#reading-shelf");
const apply = document.querySelector("#shelf-violet");
const reset = document.querySelector("#shelf-reset");
apply.addEventListener("click", () => {
shelf.style.setProperty("--shelf-accent", "#7048a4");
});
reset.addEventListener("click", () => {
shelf.style.removeProperty("--shelf-accent");
});
The starter stylesheet already uses var(--accent) for the card border and its tag. Run the preview, click Plum accent, then Reset accent; inspect both pieces of the card. Write the handlers in script.js and submit when both directions work.
#theme-status to Teal accent selected. The starter CSS already supplies --accent: #167069 on the card; leave that default in place.#plum-accent click, set --accent inline on #workshop-card to #713e83 and show Plum accent selected.; the card border and tag should both change.#reset-accent click, remove the inline --accent override and show Teal accent restored.; the border and tag should return to teal.Call style.setProperty("--accent", value) on the card, not on the button.
removeProperty removes the inline override so the stylesheet value wins again.