Repository navigation
Add the Basic components and draw the Material ones over them - #355
Merged
Merged
Conversation
…tion Every picker and channel slider took its coloringMode default from an internal function, so a default expression in the public API called code a caller could not; ColoringMode.defaultFor is that function, public. PlaneActionLabels describes the accessibility actions any plane offers, with or without Material, so it moves to the foundation package beside ColorPickerStrings, which builds it.
A swatch is a clip, a checkerboard and a background, so a design system without Material needs the checkerboard rather than a swatch component. The swatch draws the same tile from the same origin, and its preview is unchanged.
A design system without Material needs the channel slider's behaviour, not its look: the displayed hue for a grey, a value past the track pinning the thumb while it keeps its number, the controlled edit path, and a track computed in the channel's space and brought into sRGB. These sliders carry all of it and hand the track's gradient, already mirrored right to left, to slots that draw it however they like.
ColorSlider, ChannelSlider and AlphaSlider kept their own copy of the channel logic under a Material frame. They now add only the frame: the label row, the gradient track with its gap, the handle, the minimum touch size and the disabled look, over BasicColorSlider, BasicChannelSlider and BasicAlphaSlider. The track takes the gradient the Basic slider computed, already mirrored, so the two layers cannot draw different colors. The 27 screenshot baselines validate unchanged.
The planes' input, focus, accessibility actions and field painting move into foundation components that draw only what their thumb slot draws and take no size of their own; the Material planes add the ring-and-halo indicator, the theme's plane shape, the fallback minimum size and the disabled look over them. A value outside 0..1 is drawn at the nearer edge rather than off the plane, and a NaN no longer reaches the indicator's placement.
A picker built from a design system's own sliders and plane still needs the layout, the plane's axes, the controlled value and color forms, and the disabled state reaching every replaced part. BasicColorPicker carries them and draws nothing itself; it also lays the parts out side by side, with the plane in the start half. ColorPicker is now that layout with Material parts and its theme, and looks as before.
ColorPicker's showPlane read as a switch for any plane slot, but the picker is laid out by BasicColorPicker, which hands the plane its axes and so calls it only for a space with one hue and two other channels. A custom plane slot over sRGB, Lab, Oklab or CMYK is not drawn, whatever showPlane says.
This was referenced Sep 26, 2026
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.
A design system that does not use Material needs the picker's behaviour without its look. The foundation package gets that layer, and the Material components are rebuilt on it with their public signatures unchanged.
New in
codes.side.colorpicker.foundationBasicChannelSliderandBasicAlphaSlidercarry the channel and alpha sliders' behaviour: the displayed hue for a grey, a value past the track pinning the thumb while it keeps its number, the controlled edit path, the channel's own steps. Theirtrackandthumbslots readChannelSliderScopeandAlphaSliderScope, which extendColorSliderScopewith the channel, its value and the track'sgradient, computed in the channel's space and already mirrored right to left.BasicColorPlaneandBasicChannelPlanecarry the planes' pointer, focus, key and accessibility handling. Theirthumbslot readsColorPlaneScopeandChannelPlaneScope. They impose no size, and ashapeclips the field.BasicColorPicker, over a state, aColorValueor a ComposeColor, lays out the plane it is given (handed its axes), a slider per channel and alpha, stacked or side by side (orientation), withnullleaving the plane or alpha out. While disabled it disables the library's parts in its slots and refuses touches to the rest.Modifier.checkerboard(light, dark).ColoringMode.defaultFor(space), the default every picker's and channel slider'scoloringModetook from an internal function.PlaneActionLabelsmoves here fromcodes.side.colorpicker.ui.The Material components
ColorSlider,ChannelSlider,AlphaSlider,ColorPlane,ChannelPlaneandColorPickerare the Material look over those components: the label row, the gradient track with its gap, the handles, the minimum sizes and the disabled look.ColorSwatchdraws withModifier.checkerboard. The 27 screenshot baselines validate unchanged.ColorPlanedraws a value outside0..1at the nearer edge rather than off the plane, and no longer throws on a NaN.ColorPickerover a space with no plane never calls itsplaneslot, even withshowPlane = true.Tests: colorpicker 341 JVM, 122 Android host, 122 wasm; color 216, 206, 206; color-compose 14, 14, 14.
apiCheck, the iOS klib compile, the Android sample and the 27 screenshot previews pass.