|
| 1 | +// Colors follow the Docs 2026 Figma warning banner: Brand yellow-9 text with a yellow-7 accent. |
| 2 | +// Default and danger reuse the same scale steps in blue and red. |
| 3 | +// Brand's base scales do not invert in dark mode, so dark mode mirrors the steps explicitly, |
| 4 | +// the same way Brand's own component tokens pair a light step with a dark step. |
| 5 | +@mixin banner-colors($hue, $mode) { |
| 6 | + @if $mode == light { |
| 7 | + --banner-bg: var(--base-color-scale-#{$hue}-0); |
| 8 | + --banner-border: var(--base-color-scale-#{$hue}-7); |
| 9 | + --banner-fg: var(--base-color-scale-#{$hue}-9); |
| 10 | + } @else { |
| 11 | + --banner-bg: var(--base-color-scale-#{$hue}-9); |
| 12 | + --banner-border: var(--base-color-scale-#{$hue}-2); |
| 13 | + --banner-fg: var(--base-color-scale-#{$hue}-0); |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +@mixin banner-variant($hue) { |
| 18 | + @include banner-colors($hue, light); |
| 19 | + |
| 20 | + :global([data-color-mode="dark"]) & { |
| 21 | + @include banner-colors($hue, dark); |
| 22 | + } |
| 23 | + |
| 24 | + // No-JS fallback; see the note in src/frame/stylesheets/index.scss. Scoped to html because |
| 25 | + // the @primer/react ThemeProvider wrapper also starts as auto, even when html is light. |
| 26 | + // Brand keeps its light link blue here, so links use the banner text color for contrast. |
| 27 | + @media (prefers-color-scheme: dark) { |
| 28 | + :global(html[data-color-mode="auto"][data-dark-theme*="dark"]) & { |
| 29 | + @include banner-colors($hue, dark); |
| 30 | + |
| 31 | + a { |
| 32 | + color: var(--banner-fg); |
| 33 | + } |
| 34 | + } |
| 35 | + } |
| 36 | +} |
| 37 | + |
| 38 | +.banner { |
| 39 | + padding: var(--base-size-16, 1rem); |
| 40 | + color: var(--banner-fg); |
| 41 | + background-color: var(--banner-bg); |
| 42 | + border: var(--brand-borderWidth-thin, 1px) solid var(--banner-border); |
| 43 | + border-radius: var(--brand-borderRadius-medium, 0.5rem); |
| 44 | + |
| 45 | + p:last-child { |
| 46 | + margin-bottom: 0; |
| 47 | + } |
| 48 | + |
| 49 | + // Link color alone is not distinct enough from banner text, especially in dark mode. |
| 50 | + a { |
| 51 | + text-decoration: underline; |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +.default { |
| 56 | + @include banner-variant(blue); |
| 57 | +} |
| 58 | + |
| 59 | +.warning { |
| 60 | + @include banner-variant(yellow); |
| 61 | +} |
| 62 | + |
| 63 | +.danger { |
| 64 | + @include banner-variant(red); |
| 65 | +} |
0 commit comments