<!-- INCORRECT --><mds-pref-theme-item name="cool" label="Freddo" scheme="all"></mds-pref-theme-item>
<!-- CORRECT --><mds-pref-theme name="default" scheme="all"> <mds-pref-theme-item name="cool" label="Freddo" scheme="all"></mds-pref-theme-item></mds-pref-theme><!-- INCORRECT - the parent overwrites both on load and marks "default" --><mds-pref-theme name="default" scheme="all"> <mds-pref-theme-item name="default" label="Predefinito" scheme="all"></mds-pref-theme-item> <mds-pref-theme-item name="cool" label="Freddo" scheme="all" selected></mds-pref-theme-item> <mds-pref-theme-item name="warm" label="Caldo" scheme="all" selected></mds-pref-theme-item></mds-pref-theme>
<!-- CORRECT - set the active theme on the parent; it marks the matching child --><mds-pref-theme name="cool" scheme="all"> <mds-pref-theme-item name="default" label="Predefinito" scheme="all"></mds-pref-theme-item> <mds-pref-theme-item name="cool" label="Freddo" scheme="all"></mds-pref-theme-item> <mds-pref-theme-item name="warm" label="Caldo" scheme="all"></mds-pref-theme-item></mds-pref-theme><!-- INCORRECT --><script> document.querySelector('mds-pref-theme-item').addEventListener('click', (e) => { applyTheme(e.target.getAttribute('name')); });</script>
<!-- CORRECT --><script> document.querySelector('mds-pref-theme-item').addEventListener('mdsPrefThemeItemSelect', (e) => { applyTheme(e.detail.name); });</script>/* INCORRECT */mds-pref-theme-item >>> mds-button { font-weight: bold;}mds-pref-theme-item .theme-preview { border: 2px solid red;}
/* CORRECT */mds-pref-theme-item[name="warm"] { --mds-pref-theme-item-color-variant-primary: rgb(var(--magma-accent-emphasis-hover)); --mds-pref-theme-item-color-background: rgb(var(--magma-wash-strong));}<!-- INCORRECT --><mds-pref-theme-item name="cool" scheme="light-only"></mds-pref-theme-item><mds-pref-theme-item name="warm" scheme="night"></mds-pref-theme-item>
<!-- CORRECT --><mds-pref-theme-item name="cool" scheme="light"></mds-pref-theme-item><mds-pref-theme-item name="warm" scheme="dark"></mds-pref-theme-item>