fix(ui): unify switch accent colors

This commit is contained in:
vyctorbrzezowski
2026-08-25 05:27:39 -03:00
parent dd9195291a
commit df2afae9f5
3 changed files with 24 additions and 3 deletions
@@ -73,4 +73,21 @@ describe("Control UI base theme tokens", () => {
expect(violations).toEqual([]);
});
it("routes every Web Awesome switch through the shared accent", () => {
const baseCss = fs.readFileSync(path.join(stylesDir, "base.css"), "utf8");
const localOverrides = collectFiles(stylesDir, [".css"])
.filter((filePath) => !filePath.endsWith("base.css"))
.filter((filePath) =>
/[^{}]*wa-switch[^{}]*\{[^}]*--wa-form-control-activated-color:/su.test(
fs.readFileSync(filePath, "utf8"),
),
)
.map((filePath) => path.relative(stylesDir, filePath));
expect(baseCss).toMatch(
/wa-switch\s*\{[^}]*--wa-form-control-activated-color:\s*var\(--accent\);[^}]*\}/su,
);
expect(localOverrides).toEqual([]);
});
});
+7
View File
@@ -1128,6 +1128,13 @@ a:hover {
text-decoration-thickness: 2px;
}
/* Web Awesome defaults checked switches to brand blue. Keep every switch on
the Control UI accent, matching native check controls and custom switches. */
wa-switch {
--wa-form-control-activated-color: var(--accent);
--wa-color-focus: var(--ring);
}
/* Web Awesome dropdown items ship `cursor: pointer` on their shadow host.
Document rules beat `:host`, so route them through the policy here — and
re-add the disabled cue this override would otherwise clobber. */
-3
View File
@@ -473,9 +473,6 @@
}
wa-switch.settings-toggle {
/* Web Awesome defaults to brand blue; settings controls follow the active scene. */
--wa-form-control-activated-color: var(--accent);
--wa-color-focus: var(--ring);
flex: none;
}