Tooling · Catalogs: the audit reads active and code; avatar and container sizes

The audit now holds fg_subtle on active, a selected row's fill, and
each syntax color over the editor's surface, a code block and the
current line. What it found is fixed at the source: fg_subtle is
#696764 light and #94928f dark, syntax.comment follows it, and the
light number, constant and attribute darken to #a3591b, #aa5529 and
#9f5d12. The token viewer adds avatar and container sizes, draws a
container at its share of the widest so it stays in its row, and
names what it shows: the shared colors and scales. Tests pin every
variant, the hue each chart row reads and the code rows.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-28 08:57:52 -04:00
1 parent d5271d03ea
commit a7e492f28e
7 files changed
+153 -27

No files matched your search

+52 -6
View File
@@ -37,8 +37,47 @@ fn the_viewer_names_each_token_with_its_value(cx: &mut TestAppContext) {
"token-colors.hue(0) Blue-{}",
hex(Rgba::from(light.chart[0]))
);
let measures: [(&str, &[&str], &[u32]); 7] = [
(
"TextSize::",
&["Xs", "Sm", "Base", "Md", "Lg", "Xl", "Xxl", "Display"],
&[11, 12, 13, 14, 16, 20, 24, 32],
),
("Radius::", &["Sm", "Md", "Lg", "Xl"], &[4, 6, 8, 12]),
("ControlSize::", &["Sm", "Md", "Lg"], &[24, 28, 32]),
(
"IconSize::",
&["Xs", "Sm", "Md", "Lg", "Xl", "Xxl"],
&[12, 14, 16, 20, 24, 32],
),
(
"AvatarSize::",
&["Xs", "Sm", "Md", "Lg", "Xl"],
&[20, 24, 32, 40, 56],
),
("ContainerSize::", &["Sm", "Md", "Lg"], &[640, 960, 1200]),
(
"gap_",
&["1", "2", "3", "4", "6", "8"],
&[4, 8, 12, 16, 24, 32],
),
];
for (kind, names, sizes) in measures {
for (name, size) in names.iter().zip(sizes) {
let selector = format!("token-{kind}{name}-{size}");
assert!(shown(&selector, cx), "{selector}");
}
}
for level in ["Raised", "Floating", "Modal"] {
assert!(shown(&format!("token-Elevation::{level}"), cx), "{level}");
}
for (ix, name) in [(0, "black"), (15, "bright white")] {
let code = hex(Rgba::from(light.ansi[ix]));
let selector = format!("token-colors.ansi[{ix}] {name}-{code}");
assert!(shown(&selector, cx), "{selector}");
}
for selector in [
"token-colors.fg_subtle-#6f6d6a",
"token-colors.fg_subtle-#696764",
&keyword,
&blue,
"token-TextSize::Sm-12",
@@ -58,7 +97,7 @@ fn the_viewer_names_each_token_with_its_value(cx: &mut TestAppContext) {
});
cx.run_until_parked();
assert!(
shown("token-colors.fg_subtle-#8c8a87", cx),
shown("token-colors.fg_subtle-#94928f", cx),
"the dark palette"
);
let compact = cx.update(|window, cx| {
@@ -85,16 +124,23 @@ fn the_checker_counts_failures_first(cx: &mut TestAppContext) {
cx.update(Theme::init);
let (_, cx) = cx.add_window_view(|_, _| Audit);
cx.run_until_parked();
assert!(shown("contrast-summary-41-0", cx), "every pair passes");
assert!(shown("contrast-summary-81-0", cx), "every pair passes");
assert!(shown("contrast-fg-bg-AAA", cx));
assert!(shown("contrast-fg_subtle-hover-AA", cx), "4.53:1 on hover");
assert!(
shown("contrast-fg_subtle-active-AA", cx),
"a selected row's detail"
);
assert!(
shown("contrast-syntax.comment-hover-AA", cx),
"a comment on the current line"
);
assert!(shown("contrast-focus-surface-AA", cx));
assert!(shown("contrast-chart Blue-bg-AA", cx));
cx.update(|_, cx| Theme::update(cx, |theme| theme.colors.fg_subtle = theme.colors.bg));
cx.run_until_parked();
assert!(
shown("contrast-summary-41-5", cx),
"five surfaces under fg_subtle"
shown("contrast-summary-81-6", cx),
"six surfaces under fg_subtle"
);
let failing = cx
.debug_bounds("contrast-fg_subtle-hover-Fails")