Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public partial class BitAccentColorSwitcher : BitComponentBase
/// The accent colors offered when <see cref="BitAccentColorConfig.Accents"/> is not set (on the
/// <see cref="Config"/> parameter nor on the configuration registered in DI): the six
/// <see cref="BitAccentColorPresets"/> hues, starting with the packaged palette's own primary.
/// That first item is named "Default" rather than after a hue: its token is the Fluent blue the
/// service treats as "no override", but the swatch paints the primary of whichever packaged
/// preset is active (purple under Material, iOS blue under Cupertino - see the --bit-acs-ntr
/// custom property in BitAccentColorSwitcher.scss), so naming it "Blue" would be wrong there.
/// That first item is named "Default" rather than after a hue: its token is the blue the service
/// treats as "no override", but the swatch paints the primary of whichever packaged preset is
/// active (iOS blue under Cupertino - see the --bit-acs-ntr custom property in
/// BitAccentColorSwitcher.scss), so naming it "Blue" would be wrong there.
/// </summary>
public static readonly IReadOnlyList<BitAccentColorItem> DefaultAccents =
[
Expand Down Expand Up @@ -190,12 +190,12 @@ private static string GetSwatchColor(string? color)

// The neutral accent is "the packaged palette's own primary" (see BitAccentColorService):
// picking it clears the overrides, so what it yields is whatever primary the active preset
// ships - Fluent's blue, Material's purple, Cupertino's system blue. Its swatch therefore
// paints through --bit-acs-ntr, which the stylesheet sets per packaged preset (the Fluent
// blue by default; the Material and Cupertino bundles retune it), with the token's own hex
// as the fallback for a page that loads none of the bundles. Read from a custom property
// rather than from the theme's --bit-clr-pri, which an applied accent overrides - the point
// of this swatch is to show the primary underneath that override.
// ships - this blue under Fluent, Fluent 2 and Material, Cupertino's system blue. Its swatch
// therefore paints through --bit-acs-ntr, which the stylesheet sets per packaged preset (this
// blue by default; the Cupertino bundle retunes it), with the token's own hex as the fallback
// for a page that loads none of the bundles. Read from a custom property rather than from the
// theme's --bit-clr-pri, which an applied accent overrides - the point of this swatch is to
// show the primary underneath that override.
if (BitAccentColorSsr.NormalizeToken(value) == BitAccentColorSsr.NormalizeToken(BitAccentColorPresets.Blue))
{
return $"var(--bit-acs-ntr, {BitAccentColorPresets.Blue})";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
.bit-acs {
--bit-acs-size: #{rem2(24px)};
--bit-acs-gap: #{rem2(10px)};
// What the neutral ("Default") swatch paints: the primary the active packaged preset ships,
// since picking that swatch clears every accent override and leaves exactly that primary. The
// Fluent light primary here (BitAccentColorPresets.Blue - a literal, not $clr-pri, which an
// applied accent rewrites while this swatch has to keep showing the color underneath it); the
// two rules below retune it to the Material and Cupertino seeds. A custom preset sets it on
// .bit-acs to its own primary.
// What the neutral ("Default") swatch paints: the seed blue of the active packaged preset - the
// color picking that swatch returns the palette to, since it clears every accent override. A
// literal (BitAccentColorPresets.Blue) rather than $clr-pri, because an applied accent rewrites
// $clr-pri while this swatch has to keep showing the color underneath it. It is the primary the
// Fluent and Material light schemes ship, and Fluent 2's #0F6CBD is the same blue a shade off;
// their dark schemes lighten that same hue (#4FA3F4), so the swatch names the palette family's
// blue rather than the exact primary of the scheme in use. The rule below retunes it to
// Cupertino's seed, the one packaged preset far enough away for the difference to show. A custom
// preset sets it on .bit-acs to its own seed.
--bit-acs-ntr: #1276C6;

// The seeds the packaged Material and Cupertino palettes are generated from (M3 baseline
// primary, iOS system blue). Matched on the prefix so the scheme suffix and a scoped preset
// (the attribute on an ancestor rather than on :root) both count.
[bit-theme^="material"] & {
--bit-acs-ntr: #6750A4;
}

// The seed the packaged Cupertino palette is generated from (iOS system blue). Matched on the
// prefix so the scheme suffix and a scoped preset (the attribute on an ancestor rather than on
// :root) both count.
[bit-theme^="cupertino"] & {
--bit-acs-ntr: #0071E3;
}
Expand Down
Loading
Loading