Repository navigation
Conversation
… color field and a channel strip
The Color Wheel panel's menu gains Wheel View and Box View, and Box
Channel with Hue, Saturation, Brightness, Red, Green and Blue while the
box shows. The box takes the wheel's place: a color field with a 22 pt
channel strip at its right. The field shows the other two components on
the Color Picker's axes (Hue: saturation across and brightness up; Red:
blue across and green up). A click or drag in the field sets those two,
and the strip sets the channel; a drag is one undo step, and picks go
through the same paint commands and color model rules as the wheel's.
With no color to edit, the field and the strip show no markers and read
0 to screen readers, as the wheel does.
ui.colorWheel {view?, channel?} sets the view and the channel and
returns them. Params that are not an object, another key or a value off
the list are an error and change nothing. Both settings are kept with
the preferences, and a saved value the build does not know reads as
that key's default without losing the other preferences.
The strip takes the arrow keys after a click and offers screen readers
its increment, decrement and set-value actions. The Color Picker's
channel slider uses the same widget, so it now takes the arrow keys and
offers those actions too. New strings have rows in the complete
catalogs, and docs/mcp.md and docs/control-protocol.md describe the
command.
The Color Wheel panel's menu gets OKLCH Sliders: L, C and H rows under the
wheel or the box that edit the color by the OKLCH lightness (0 to 100 %),
chroma (0 to 100 % of 0.4) and hue of its display sRGB, as CSS Color 4
defines them. Each track dims the colors outside sRGB, and a tick on the C
track marks the largest chroma that fits; a color outside sRGB keeps L and H
and takes that chroma. The rows are gray, and the menu item and
ui.colorWheel {sliders: "oklch"} are refused, while the working RGB space is
not sRGB. The choice is kept with the preferences.
- vectorcraft-color: oklab.rs with OKLCH conversions and max_chroma.
- color.convert {to: "oklch"} answers [L %, C, H°].
- ui.colorWheel takes sliders next to view and channel.
Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md.
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
- The C row's tick reads the slider's own rect, so it stays on the bar
when the row is taller than the rail. `color_rail_bar` gives the bar
for both the rail and the tick.
- The L and H tracks show a color outside sRGB at the largest chroma
that fits, the color a pick there stores, instead of clamping each
channel.
- The menu item uses `menu_item_hint`, which translates like
`menu_item`, and `menu_item_name` is unchanged.
- `color.convert {to: "oklch"}` says that any color outside sRGB (Lab,
CMYK, or RGB in a wider working RGB space) is clipped to sRGB first,
with a test for a Lab color.
- docs/mcp.md wraps the new paragraph; gu.tsv puts the new rows where
the other catalogs put them.
3 of 4 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #7602. Until #7602 merges, this diff also shows its commit; this pull request's own commits are
f763b86fdcand3608506214.What and why
The Color Wheel panel menu gets OKLCH Sliders. Turning it on adds L, C and H rows under the wheel or the box. They edit the current color by the OKLCH lightness (0 to 100 %), chroma (0 to 100 % of 0.4) and hue (0 to 360°) of its display sRGB, with the percent references CSS Color 4 gives for
oklch()(https://www.w3.org/TR/css-color-4/#specifying-oklab-oklch). The rows themselves are VectorCraft's own design.ui.colorWheel {sliders: "oklch"}returns an error. The rows are also gray when there is no color to edit.ui.colorWheeltakes asliderskey (noneoroklch) next toviewandchanneland returns all three. The choice is kept with the preferences, and a saved value this build cannot read falls back to the default without changing the other settings.color.convert {to: "oklch"}answers[L %, C, H°]of the color's display sRGB; a color outside sRGB (Lab, CMYK, or RGB in a wider working RGB space) is clipped to sRGB first.vectorcraft-colorgetsoklab.rswith the OKLCH conversions andmax_chroma. It reusessrgb_to_oklabandoklab_to_srgbfromcrates/color/src/libraries.rs, andmax_chromabisects the sRGB edge as that file'soklchdoes (libraries.rs:138). The new strings have rows in every catalog, andcrates/mcp/src/ui_catalog.rsis regenerated.docs/mcp.md,docs/control-protocol.mdanddocs/target-app-parity.mddescribe the option.How it was tested
New tests: 6 in
crates/color/src/oklab.rs(red against the OKLab matrices and back, the CSS examples, the 216 web colors round trip, grays, a chroma past the gamut, black, white and bad numbers),convert_to_oklch_answers_lightness_chroma_and_huein the engine (red, a gray, a CMYK color and a Lab color outside sRGB), and 11 incrates/ui-egui/src/panels/tests_color_wheel.rs(the rows' values, a drag on L, keys and screen-reader actions, the dimmed tracks and the tick, a change of working space, a CMYK fill, the panel menu, the sRGB check, lenient reading of saved settings, andui.colorWheel'ssliderskey). Each test was shown failing with the code under test broken. #7602's settings tests intests_color_wheel_box.rsnow expect thesliderskey too.cargo fmt --all -- --checkcargo clippy -p vectorcraft-color -p vectorcraft-engine -p vectorcraft-ui-egui -p vectorcraft-mcp --all-targets -- -D warningscargo test -p vectorcraft-color -p vectorcraft-engine -p vectorcraft-ui-egui -p vectorcraft-mcp: 12313 passed, 0 failed, 5 ignoredcargo xtask brands,cargo xtask layers,cargo xtask assetsandcargo xtask ui-commands --checkThe branch merges cleanly with
mainat460d211995, andcargo check --testsof the four crates, the engine'scolormgmttests andcargo xtask ui-commands --checkpass on the merged tree. With #7617, #7629 and #7630, which also build on #7602, it conflicts at the lines they all add to: theui.colorWheeldescription (ui_commands.rs, the regeneratedui_catalog.rsand the docs), the panel menu and the box settings tests; with #7617 and #7630 also instate.rs, with #7629 and #7630 at thedocs/target-app-parity.mdline after #7602's, and with #7630 at thewidgets.rsexport list. Each resolution combines both sides.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.