@microbit/ui 0.1.0-alpha.18 → 0.1.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,43 @@ import { tooltip } from "./Tooltip.recipe";
45
45
  import { field } from "./Field.recipe";
46
46
  import { toast } from "./Toast.recipe";
47
47
 
48
+ // The family gray ramp: pure neutrals as the library default. The two
49
+ // halves have different jobs and different override rules:
50
+ //
51
+ // - 10–300 are surface stops (panels, page backdrops, hairlines, subtle
52
+ // fills). Presets may freely override these values — pinning an app's
53
+ // existing surfaces or applying a brand tint — because a few bits of
54
+ // lightness here reads across a whole viewport.
55
+ // - 350 is the decorative/state fill stop (~2.1:1): avatar discs, skeleton
56
+ // pulse, pressed fills. Never text or boundaries.
57
+ // - 400–900 are ink stops (outlines, placeholders, text) with a contrast
58
+ // contract on white: 400 ≥ 3:1, the accessible form-outline stop
59
+ // (WCAG 1.4.11); 500 ≥ 4.5:1, text-safe secondary (placeholders, muted
60
+ // icons). Presets may re-tint these only luminance-matched — the
61
+ // contrast figures are the contract, hue is free.
62
+ //
63
+ // Override values, never names: raw var(--colors-gray-*) references and
64
+ // paired private presets depend on the names, so a rename is a breaking
65
+ // change to both and needs every app and paired preset moved in lockstep
66
+ // (as was done when Chakra's misnamed darker-than-50 stop `25` became
67
+ // `75`). And never override partially in a way that lets a stop fall
68
+ // through to a different grey system.
69
+ const gray = {
70
+ 10: { value: "#fcfcfc" },
71
+ 50: { value: "#f9f9f9" },
72
+ 75: { value: "#f5f5f5" },
73
+ 100: { value: "#f1f1f1" },
74
+ 200: { value: "#e7e7e7" },
75
+ 300: { value: "#d4d4d4" },
76
+ 350: { value: "#b4b4b4" }, // ~2.1:1 — decorative fills only
77
+ 400: { value: "#949494" }, // 3.05:1 — accessible outline stop
78
+ 500: { value: "#767676" }, // 4.54:1 — text-safe secondary
79
+ 600: { value: "#575757" },
80
+ 700: { value: "#404040" },
81
+ 800: { value: "#262626" },
82
+ 900: { value: "#1a1a1a" },
83
+ };
84
+
48
85
  /**
49
86
  * The base preset: the complete, working micro:bit design system. The base
50
87
  * token scales (base-tokens.ts), the micro:bit house style
@@ -92,16 +129,12 @@ export const basePreset = definePreset({
92
129
  tokens: {
93
130
  colors: {
94
131
  ...colors,
95
- gray: {
96
- ...colors.gray,
97
- // Very light grays the family's designs use below Chakra's 50.
98
- 10: { value: "#fcfcfc" },
99
- 25: { value: "#f5f5f5" },
100
- },
132
+ gray,
101
133
  // OSS default brand ramps (see the brand contract above). `brand`
102
- // aliases Chakra blue; `brand2` Chakra's *unmodified* gray (not the
103
- // `gray` above, whose 10/25 additions are lighter getting this
104
- // wrong once made card text near-invisible).
134
+ // aliases Chakra blue; `brand2` stays Chakra's slate gray a frozen
135
+ // legacy alias, deliberately decoupled from the neutral `gray` above
136
+ // so ml-trainer's OSS look and `statusBarBg`'s default don't move.
137
+ // Removing the slot is a follow-up needing an ml-trainer lockstep.
105
138
  brand: colors.blue,
106
139
  brand2: colors.gray,
107
140
  },