diff --git a/crates/engine/src/tests/colorcontrast.rs b/crates/engine/src/tests/colorcontrast.rs index 6b43325d74..8a8c203488 100644 --- a/crates/engine/src/tests/colorcontrast.rs +++ b/crates/engine/src/tests/colorcontrast.rs @@ -899,6 +899,9 @@ fn a_fix_passes_as_the_canvas_paints_it() { let painted = fix.to_rgb_uncalibrated().map(|v| (v.clamp(0.0, 1.0) * 255.0).round() / 255.0); let got = vectorcraft_color::wcag::contrast_ratio(painted, [1.0; 3]); assert!(got >= 4.5, "{fix:?} paints as {painted:?}: {got}"); + // The fix is the closest one: the gray one 8-bit step lighter fails. + let lighter = painted.map(|v| (v + 1.0 / 255.0).min(1.0)); + assert!(vectorcraft_color::wcag::contrast_ratio(lighter, [1.0; 3]) < 4.5, "{fix:?} paints as {painted:?}"); let back = s.execute("color.contrast", &json!({"color": r["fix"]["aa"], "against": "#ffffff"})).unwrap(); assert!((4.5..4.57).contains(&ratio(&back)), "{back}"); } diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 3181a5a903..ee1469a833 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -816,7 +816,7 @@ type Bands = Vec<(f32, FieldPoint, FieldPoint)>; /// field coordinates. The field is sampled on a grid of `n` + 1 columns and rows, and each cell /// whose corners fall on both sides gets a segment between the crossings on its edges, placed by /// bisection (marching squares; a cell with two opposite corners passing is split by its center). -/// With `bands`, around a failing sample higher than its neighbors in a column or a row, the highest +/// With `narrow`, around a failing sample higher than its neighbors in a column or a row, the highest /// ratio is looked for, so a passing band narrower than the samples gets its two edges too, joined /// from column to column or from row to row. Segments that share an end are joined into one /// polyline. diff --git a/docs/mcp.md b/docs/mcp.md index 8246023baa..b884e3e6b7 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -698,7 +698,7 @@ box, `contrastFor` (`normalText`, `largeText` or `graphics`, which has AA only) `contrastBackground` (a color, or `null` for the color behind the selection) pins the background it measures against, as `color.contrast` below answers it. With the row shown, the wheel's square and the box's field draw lines where the color picked there meets AA (solid) and AAA (dashed) for the category, and when the color fails a level, a chip at the -end of the row shows `color.contrast`'s `fix` for the first level it fails; a click applies it. +end of the row shows `color.contrast`'s `fix` for the first level it fails; a click, or Enter while the chip has the focus, applies it. `{"documentColors": true}` shows the row the panel menu's Show Document Colors adds under the wheel or the box. The command returns `{view, channel, sliders, gamut, harmony, harmonyRule, contrast, contrastFor, contrastBackground, vision, documentColors}`, and the settings are kept with the preferences.