cms::with_active put its settings in place of the active settings on
its thread, but cms::working() still read the process-wide working
settings. Code inside with_active could therefore read active settings
from one context and working settings from another, and a set_active
on another thread changed the working half while the scope ran.
Inside with_active, working() now gives the working settings of the
context it was given: the ones for_document put a document's profiles
in place of, else that context itself. use_document_profiles and
for_document still read the process working settings, because they
install or keep process-wide contexts. Outside with_active nothing
changes. The app calls with_active only with for_document contexts
(canvas panes and the color mode change on open), whose working
settings are the process ones, so the app reads the same working
settings as before.
The gamut test allowed 1e-4 beyond 0..1, so OKLCH colors such as L 0.01, C 0.01,
H 0 were clipped at their own chroma and not reported as lowered, and the C track
marked the wrong maximum. The allowance is now 1e-5, above the 1.7e-6 matrix
round-trip error of sRGB boundary colors.
The contrast row, its menu rows and its tests move to the craft UI framework,
as main's Color Wheel panel now uses it:
- The row is a Row with a Swatch named Background (a color well whose value is
the background's hex value) and Text for the ratio and the AA and AAA
results, each with the WCAG minimums as its tooltip.
- Show Contrast, Contrast For and Contrast Background are rows of the panel
menu's items (ui.colorWheel.contrast, contrastFor.<id>,
contrastBackground.below and contrastBackground.current), after Show
Opacity. Current Color is gray, and its row answers an error, while the
active proxy has no solid color.
- The kept background and ratio answer are fields of WheelUi instead of panel
state. The answer's key also holds whether the Live Paint Bucket paints,
which changes the proxies' paint without a document revision.
- The row's tests run in the panel's Fixture by accessible name; the drag test
runs an interaction whose previews set the fill, as the Show Document Colors
drag test does.
- The settings lists in the params text, docs/mcp.md and the tests take both
opacity and the contrast keys.
VectorCraft's UI moves onto the shared craft UI framework in storytold/craft-libs (`next`; the framework side is storytold/craft-libs#2809), as PhotoCraft's did. The app keeps its engine, document model, file formats, commands and automation; its windows, panels, bars, dialogs and canvas are now built and driven by the framework: shell, docking and panels, hosted dialogs, keyboard, focus, IME and pointer routing, and theme tokens.
About 264,000 lines of VectorCraft's own egui UI code are removed and about 154,000 added. craft-libs is pinned at bf62d509f (in `next`), the egui fork at f5025284.
Tests that drove the old UI were rewritten against the port where only their premise changed, with their assertions kept. The UI tests still failing at merge, and their follow-ups, are listed in the pull request.
- The contrast lines count a narrow band's crossings among a cell's
crossings where no band on the next line joins it, so a band that
widens past the samples is no longer cut across.
- The lines show where a pick passes when the fill or stroke is None or
a pattern (`contrast_pick_backdrop`), and are hidden while Alt sends
a pick to the other proxy.
- The Background chip shows the background the ratio uses, so a pinned
100 % K shows as black with a rich black Appearance of Black.
- `color.contrast` with "below" is an error when a blend mode other
than Normal mixes the color with art that is not one color where its
level reads it; a blend inside an isolating group over such art still
answers.
- `wcag::closest_passing`, `color.contrast`'s params text and
docs/mcp.md say that a nearer passing color can be missed when the
passing lightnesses fall in more than one stretch, that a null fix
shows no chip, and that a null `contrastBackground` sets Behind
Selection.
- The wide-gamut contrast test restores the color settings through
`restored_settings()`.
The fix search lowered an out-of-gamut chroma by bisection, which stops
at the first gamut boundary. Near blue the chromas sRGB holds at one
lightness come in two stretches, so a blue that needed a little more
contrast lost much of its chroma (blue on #B8B8B8 got a fix of chroma
0.25 against blue's 0.31). The search now uses oklab::from_oklch, which
takes the largest chroma below the asked one that fits.
Brings in #7632's exact black and white at the OKLCH lightness endpoints, the color.convert docs on the chroma that fit, and the panel menu items that run ui.colorWheel. Show Opacity and Show Hex Field run ui.colorWheel the same way.
The help, the color module docs and docs/mcp.md state that a function's
arguments are literal numbers, percentages, angles and none, and that
calc(), var(), color-mix(), other nested functions, named colors and the
other color functions and spaces are errors.
from_oklch returns exactly black at lightness 0 and exactly white at
lightness 1, as CSS Color 4 specifies, and reports a positive chroma
there as lowered. The gamut tolerance no longer leaves a positive red
channel at L=0.
The command text and docs say a color outside sRGB takes the largest
chroma that fits at or below the one asked for, that color.convert
measures the stored color's display sRGB, and that a null key keeps its
value. The saved-settings test also checks that an unknown slider value
keeps the saved view.
The chromas sRGB holds along a ray of fixed lightness and hue can come
in several stretches, and the search looked past the first one only
near a primary color's hue. Near black the gamut slack opens stretches
at other hues: at L 0.02 and H 242 degrees the ray fits up to about
0.022 but the search stopped near 0.012, so the chroma tick sat too low
and a pick past the gamut lost more chroma than it had to.
Each linear sRGB channel is a cubic in the chroma, so the search now
takes the chromas where a channel meets a gamut bound, between each
cubic's turning points, and keeps the largest one that fits. A test
compares the result with a scan of the ray at 720 lightness and hue
pairs.
Follow-up to #8400. A Perceptual gradient expands each segment into
stops on its OKLab curve. Between two stops of the same color the round
trip through OKLab rounded the color, so a stretch between two
paper-white stops came out as nearly white RGB. On a PostScript plate
the separator then saw ink there, and an overprinting gradient painted
over the ink below across that stretch.
Gradient::expanded now gives a stop between two stops of the same color
that color, unchanged, for every method. GradientMethod::mix and
Gradient::sample are not changed.