Skip to content

Commit

Permalink
fix(color-context tokens): only apply when .calcite-mode-auto is ap…
Browse files Browse the repository at this point in the history
…plied (#8344)

**Related Issue:** #8343

## Summary

Resolves bug where the @media query, which applied light and dark
color-context tokens on prefers-color-scheme in CSS, was applied at
`:root` instead of `.calcite-mode-auto`
  • Loading branch information
alisonailea authored Dec 6, 2023
1 parent c8230d0 commit 19de817
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ export function formatExtraOutput(
? index.mixin.map(([mixinName, output]) => {
const m = ensureIfArray(outputObject[`${output}.${args.platform}`]);
return Array.isArray(m)
? `@mixin ${mixinName} {\n\t${m.map((o) => `${o}`.replace("$", "--")).join("\n\t")}\n}`
? `@mixin ${mixinName} {\n\t${m.map((o) => `${o}`.replaceAll("$", "--")).join("\n\t")}\n}`
: "";
})
: [];
const medias = index.media
? index.media.map(([mediaSchemed, output]) => {
const m = ensureIfArray(outputObject[`${output}.${args.platform}`]);
const cssProps = m.map((o) => `${o}`.replaceAll("$", "--"));
return Array.isArray(m)
? `@media (${mediaSchemed}) {\n\t:root {\n\t\t${m
.map((o) => `${o}`.replace("$", "--"))
.join("\n\t\t")}\n\t}\n}`
? `${
output === "light" ? `:root {\n\t${cssProps.join("\n\t")}\n}\n` : ""
}@media (${mediaSchemed}) {\n\t.calcite-mode-auto {\n\t\t${cssProps.join("\n\t\t")}\n\t}\n}`
: "";
})
: [];
Expand Down

0 comments on commit 19de817

Please sign in to comment.