Add saturation, value, brightness and color blind views
This commit is contained in:
@@ -28,11 +28,52 @@ cargo run --release -- /path/to/screenshot.png
|
||||
5. **Save crop PNG** writes a uniquely named PNG in the system temporary directory
|
||||
and displays its path. Drop an image or click **Open image…** to browse for a file in KDE's file picker.
|
||||
|
||||
The HSV histogram has 36 ten-degree bins. Switch between pixel counts and equal
|
||||
weight per distinct RGB color. Colors with saturation below 5% are counted
|
||||
separately as neutrals. The palette is exact (no quantization), ordered by count,
|
||||
then RGB for deterministic ties. Fully transparent pixels are excluded; partially
|
||||
transparent pixels retain their stored RGB values and count once.
|
||||
## Color analysis and vision checks
|
||||
|
||||
The **Color analysis** tab has four distributions:
|
||||
|
||||
- **Hue**: HSV hue in 36 ten-degree bins; saturation below 5% counts as neutral.
|
||||
- **Saturation**: HSV saturation, from neutral to fully saturated.
|
||||
- **Brightness (V)**: HSV value, the maximum RGB channel. This is not perceived
|
||||
lightness: fully saturated red and green both have 100% value.
|
||||
- **Luminance**: relative luminance in linear sRGB, weighted for contrast.
|
||||
|
||||
Saturation, value, and luminance use 20 five-percentage-point bins, including
|
||||
100% in the final bin. Each has a mean. Switch between pixel frequency and equal
|
||||
weight per distinct RGB color; hover bars for counts and percentages. The exact
|
||||
palette is ordered by count, then RGB for deterministic ties. Fully transparent
|
||||
pixels are excluded; partially transparent pixels retain their stored RGB values
|
||||
and count once. Pixel inspection includes HSV and relative luminance.
|
||||
|
||||
Use **Compare vision** below the selection to show the original crop alongside
|
||||
protanopia, deuteranopia, tritanopia, or grayscale. The first three use the
|
||||
Machado–Oliveira–Fernandes full-severity model, applied in linear RGB and then
|
||||
encoded back to sRGB. Grayscale uses relative luminance and tests removal of color
|
||||
cues; it does not model all aspects of achromatopsia. Preview mode does not change
|
||||
histograms, copied pixel values, or the exported PNG: those always use the original.
|
||||
|
||||
**Vision check** automatically checks all four scenarios. It flags pairs whose
|
||||
OKLab distance falls from at least 0.08 to at most 0.04, losing at least 50% of the
|
||||
original separation. These are project-specific screening heuristics, not
|
||||
validated visibility thresholds or WCAG criteria. Each scenario shows original
|
||||
and simulated swatches, numeric hex values, and up to six closest candidate pairs.
|
||||
The preview button opens the corresponding simulation for the current crop.
|
||||
|
||||
The check is bounded to the 64 most frequent **opaque** colors and reports both
|
||||
color and pixel coverage. Partially/fully transparent pixels have no known
|
||||
backdrop and are excluded from this check. No findings does **not** establish
|
||||
accessibility. The check cannot infer adjacency, text/background relationships,
|
||||
or the gameplay meaning of a color. Review important cues in context and combine
|
||||
color with shapes, labels, or differences in lightness. Select a smaller region
|
||||
when an important detail is outside the reported palette coverage.
|
||||
|
||||
References:
|
||||
|
||||
- [Chrome's contrast audits and vision simulations](https://developer.chrome.com/docs/chromium/cvd)
|
||||
- [Machado, Oliveira & Fernandes simulation model](https://www.inf.ufrgs.br/~oliveira/pubs_files/CVD_Simulation/CVD_Simulation.html)
|
||||
- [Published matrix coefficients in QGIS](https://api.qgis.org/api/qgsprevieweffect_8cpp_source.html)
|
||||
- [OKLab color space](https://bottosson.github.io/posts/oklab/)
|
||||
- [W3C: use of color](https://www.w3.org/WAI/WCAG22/Understanding/use-of-color.html)
|
||||
|
||||
Choosing a source always opens KDE's picker. The last portal token is saved at
|
||||
`$XDG_CONFIG_HOME/whoshue/config.toml` (normally `~/.config/whoshue/config.toml`)
|
||||
@@ -55,7 +96,7 @@ cannot strand the cached D-Bus connection on a stopped executor.
|
||||
many unique colors are more expensive; release builds are recommended.
|
||||
- Game-specific behavior on focus loss/minimization needs desktop testing.
|
||||
- Perceptual OKLCH views, color/hue highlighting, and comparing saved selections
|
||||
are future features; this first version uses HSV.
|
||||
are future features; the distributions currently use HSV and relative luminance.
|
||||
|
||||
## Validation
|
||||
|
||||
@@ -67,10 +108,13 @@ cargo fmt --check
|
||||
|
||||
Tests cover hue boundaries, neutral/transparent pixel handling, weighting,
|
||||
cropping, selection coordinates, pixel-format conversion, frozen-frame behavior,
|
||||
resize handling, headless UI rendering, file-picker cancellation/reopening, and
|
||||
resize handling, all histogram/vision UI views, file-picker cancellation/reopening, and
|
||||
repeated portal requests during/after capture. The portal regression test requires
|
||||
`dbus-run-session` and permission to create a local socket; it uses its own private
|
||||
bus and does not open desktop dialogs. Actual portal capture requires a running
|
||||
bus and does not open desktop dialogs. Color tests cover histogram endpoints and
|
||||
weighting, sRGB gamma, simulation reference colors, alpha handling, warning
|
||||
positives/negatives, palette coverage, and preserving source pixels.
|
||||
Actual portal capture requires a running
|
||||
Wayland desktop and permission through KDE's picker.
|
||||
|
||||
For a capture-only diagnostic (saves the first full source frame):
|
||||
|
||||
Reference in New Issue
Block a user