The trial gets a date and WB's presets get a table
Two asks, one row of the studio each. The first is copy: a band under the header, the same shape the verify bar below it takes, saying which features are on trial, on whom, and until when. It is a notice and not a task, so it wears the plain surface rather than the accent, and it carries no dismiss: the date is the message. The string is in the dictionary like every other, Vietnamese as written and English beside it — the band is one line at both lengths in a 1440-wide window, and it sets no nowrap, so a narrow window wraps it rather than cutting it. The second is the WB panel's presets. They were a wrapping strip of seven identical pills, which is the wrong shape for one kind of value read against the others: nothing about "SHADE" said 7500K, and nothing about the row said which end of the scale anything was on. They are a TABLE now — two columns of buttons, laid out as a grid — and each button is painted with the cast it puts on the frame: the same swatch the TEMPERATURE ruler already prints under its track (temperatureSwatch, the engine's own gains on a mid grey, halved), so the button and the ruler cannot disagree, and the kelvin is printed on the button beside the name. A button that is a swatch cannot use the theme's text colour for its label: the fill is a mid grey by construction, and mid grey is exactly where white and the light theme's near-black both sit near the 4.5:1 line. So the label is given the ink that fill can carry, chosen by WCAG's relative luminance against black and against white — whichever of the two ratios is larger, which is the one that cannot fall under 4.5:1. The border is that same ink, which is what makes a button stand out from the page it sits on and from the six beside it; the accent takes the border over while the preset is the one in force, since the fill can no longer say so. Both the fill and the ink ride in as inline styles — they are the value, not the theme — so the chip needed two fields and a tinted class, and the row needed a grid mode. The TEMP strip reads the same two fields through choiceChips, because the same seven presets are painted in both places and two opinions about 3200K is the bug this would have been. The chip's own value slot is deliberately unused here: `.chip .val` sets its own dim colour, and a dim grey on a mid grey button is the failure this commit is about. Verified: scripts/wb-table-check.mjs — readableInk picks the better of its two inks for black, white and four mid greys, all 151 swatches across the ruler (2500..10000K, every 50) and all seven presets clear 4.5:1 under the ink they are given, the swatch runs the way the ruler does (red up, blue down, #517eff at 2500K to #947d61 at 10000K), and the seven presets collapse to the five fills their kelvins do. In the running app through a probe: the notice prints in both languages (Vietnamese one line, unclipped), 7 buttons in a 147px + 147px grid, TUNGSTEN filled rgb(98,130,187) with ink rgb(11,14,18) and a 2px border of the same, AUTO the accent border rgb(206,117,9) while it is the preset in force, and the panel holds at 420px wide without overflowing. The panel was viewed in both themes. npx tsc --noEmit clean, npm run build clean. Co-authored-by: PenguinHarness <noreply@penguin.local>
This commit is contained in:
@@ -137,6 +137,20 @@ export function whiteBalanceGain(temperature: number, tint: number): { r: number
|
||||
]);
|
||||
}
|
||||
|
||||
// Kelvin -> the CAST a WB swatch prints. Not the colour of a blackbody at that
|
||||
// K: the number names the light the scene was shot under, so the engine
|
||||
// compensates for it and WARMS the picture as K rises (kelvinToRGB). A swatch
|
||||
// painted with the light's own colour would therefore run the other way from the
|
||||
// picture — orange under a knob that blue-d the frame. Measuring the ruler means
|
||||
// painting what the render does: the engine's own gains on a mid grey, which is
|
||||
// the same matrix step the preview puts on every pixel, so this can never drift
|
||||
// from it. Halved, so the swatch sits mid-grey in tone whatever the cast.
|
||||
export function temperatureSwatch(kelvin: number): string {
|
||||
const g = kelvinToRGB(kelvin);
|
||||
const chan = (v: number) => Math.round(Math.min(255, Math.max(0, v * 255))).toString(16).padStart(2, '0');
|
||||
return `#${chan(0.5 * g.r)}${chan(0.5 * g.g)}${chan(0.5 * g.b)}`;
|
||||
}
|
||||
|
||||
// How hard that excursion is allowed to bite. The physical ratio is brutal (the
|
||||
// blue channel carries 12x at 2500K) and it lands on sRGB-encoded, already
|
||||
// tone-mapped pixels, where the raw value clips the ends flat. 0.5 is the
|
||||
@@ -179,6 +193,25 @@ function normalizeGainLuma(gain: number[]): { r: number; g: number; b: number }
|
||||
return { r: gain[0] * s, g: gain[1] * s, b: gain[2] * s };
|
||||
}
|
||||
|
||||
// The text colour a #rrggbb fill can carry. A white-balance swatch is a mid grey
|
||||
// by construction — the engine's gains halved — so a label left at the theme's
|
||||
// own text colour sits on it at whatever contrast the two happen to have, and
|
||||
// the pale end of the ruler leaves it unreadable. The pair is chosen by the one
|
||||
// rule that answers "which of the two reads better here": the WCAG relative
|
||||
// luminance of the fill against black and against white, whichever is the larger
|
||||
// ratio — the smaller of the two can fall under 4.5:1, the larger cannot.
|
||||
// ponytail: two inks, not a per-theme palette; a third is a design decision, not
|
||||
// a bug.
|
||||
export function readableInk(bg: string): string {
|
||||
const n = parseInt(bg.slice(1), 16);
|
||||
const lin = (v: number) => (v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4));
|
||||
const rel =
|
||||
0.2126 * lin(((n >> 16) & 255) / 255) + 0.7152 * lin(((n >> 8) & 255) / 255) + 0.0722 * lin((n & 255) / 255);
|
||||
const withBlack = (rel + 0.05) / 0.05;
|
||||
const withWhite = 1.05 / (rel + 0.05);
|
||||
return withBlack >= withWhite ? '#0b0e12' : '#ffffff';
|
||||
}
|
||||
|
||||
// Sim-owned exposure bias: brightness a stock needs that is part of the stock
|
||||
// itself, never a user knob. Kept beside the matrices it compensates so the
|
||||
// values are one hop from the rows they lift. Only LC STREETLIFE VIVID carries
|
||||
|
||||
Reference in New Issue
Block a user