You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2b04671
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,12 @@
2
2
3
3
## 2.0.0 (unreleased)
4
4
5
-
2.0 builds the pickers on a color model of its own, following CSS Color 4, and removes 1.x's color classes, sliders and planes. [Migrating from 1.x](README.md#-migrating-from-1x) maps each removed declaration to its replacement.
5
+
2.0 builds the pickers on a color model of its own, following CSS Color 4, publishes them as Material 3 components over a foundation any design system can draw, and removes 1.x's color classes, sliders and planes. [Migrating from 1.x](README.md#-migrating-from-1x) maps each removed declaration to its replacement.
6
6
7
7
### Breaking changes
8
8
9
+
-**`codes.side:colorpicker` stops at 1.2.1.** 2.0 is `codes.side:colorpicker-material3`, which brings `codes.side:colorpicker-foundation`: the state, the `Basic*` components and the strings, with no Material dependency, for an app on another design system.
10
+
-**The Material components, `ColorPickerTheme`, `ColorPickerDefaults` and the theme classes are in `codes.side.colorpicker.material3`,** one package as `androidx.compose.material3` is, where 1.x had `codes.side.colorpicker.ui` and `codes.side.colorpicker.theme`.
9
11
-**A color is a `ColorValue`.** The `model`, `conversion` and `util` packages are gone: `HslColor`, `RgbColor`, `CmykColor`, `LabColor`, `OklabColor`, `OklchColor`, `OkhslColor`, `OkhsvColor`, `PickerColor`, their conversions and hex functions, and `randomHslColor`. A `ColorValue` is a color in one of fifteen spaces, in CSS's units, so HSL's saturation and lightness run 0–100 rather than 0–1.
10
12
-**`ColorPickerState` holds a `ColorValue`.** It is built from a `ColorValue` or a Compose `Color`, with no default. `state.value`, `state[channel]` and fifteen typed views (`state.hsl`, `state.okLch`, …) replace the eight typed getters, `pickerColor` and `argbInt`, and `state[channel] = x` and `state.set(view)` replace the thirty `update…` functions. Writing NaN or a value outside a channel's limit throws where 1.x ignored or clamped it.
11
13
-**The 21 channel sliders and the three planes are gone.**`ChannelSlider(state, channel)` and `ChannelPlane(state, x, y)` take any channel of any space.
@@ -24,7 +26,7 @@
24
26
-**`PlaneActionLabels` moves to `codes.side.colorpicker.foundation`.**
25
27
-**`ColorPickerColors`, `ColorPickerShapes` and `ColorPickerDimensions` are no longer data classes,** so they have no `componentN`. `copy` keeps a color or size left `Unspecified` and a shape left `null`, as Material's own color and shape classes do, and so do `ColorPickerDefaults.colors()`, `shapes()` and `dimensions()`.
26
28
-**`LocalColorPickerColors`, `LocalColorPickerShapes` and `LocalColorPickerDimensions` are no longer public.**`ColorPickerTheme` provides the values, and `ColorPickerDefaults.currentColors()`, `currentShapes()` and `currentDimensions()` read them.
27
-
-**A `thumb` slot reads its component's scope** instead of being handed an `InteractionSource`: `thumb = { MyThumb(interactionSource, thumbColor) }`. A slider's scope carries its position, whether it is enabled, its interactions and the opaque color under the thumb, and a channel or alpha slider's its channel and value, or its alpha, too; a plane's carries its position, and a channel plane's its channels and the color under the thumb. A picker's `thumb` reaches its sliders the same way.
29
+
-**A `thumb` slot reads its component's scope** instead of being handed an `InteractionSource`: `thumb = { MyThumb(interactionSource, thumbColor) }`. A slider's scope carries its position, whether it is enabled, its interactions and the opaque color under the thumb, and a channel or alpha slider's its channel and value, or its alpha, too; a plane's carries its position, and a channel plane's its channels and the color under the thumb. A picker's `thumb` reaches its sliders the same way. It is no longer nullable: leave it out for the default.
28
30
-**Sliders and planes take `dimensions`** in place of `thumbWidth`, `thumbTrackGap` and `ColorSlider`'s `trackHeight`. `dimensions = ColorPickerDefaults.currentDimensions().copy(thumbWidth = 48.dp)` changes one size and keeps the theme's others.
29
31
-**`ColorSlider` takes `trackColors: List<Color>`** in place of `gradientColors: ImmutableList<Color>`. kotlinx-collections-immutable is no longer a dependency.
30
32
@@ -49,6 +51,8 @@
49
51
-**`ColorPickerDefaults.SliderThumb` and `ColorPickerDefaults.PlaneThumb`,** the default slider and plane thumbs, for a `thumb` slot that draws them beside something of its own.
50
52
-**`ColorPickerDefaults.plane()`, `channelSlider()` and `alphaSlider()`,** the slots a picker draws by default, for a slot that wraps one.
51
53
-**`orientation` and `dimensions` on every picker.**`Orientation.Horizontal` puts the plane beside the sliders.
54
+
-**`LocalColorPickerEnabled`,** false inside a disabled `BasicColorPicker`: for a label or frame of your own, outside every slot's scope, that should look disabled with the picker.
55
+
-**`rememberCheckerboardBrush(light, dark)`,** the checkerboard `Modifier.checkerboard` draws, as a `Brush` for a shape of your own.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ In order to create a new feature request or bug report just file an issue. To fi
18
18
- Send pull requests targeting **master** (fork the repository if you don't have write access).
19
19
- CI (`build.yml`) must pass before a pull request can be merged.
20
20
21
-
Versioning follows [Semantic Versioning](https://semver.org): public API is added only in a minor release and removed or changed incompatibly only in a major one, and a patch leaves it alone. CI runs `scripts/check-api-removals.sh`, which fails when a declaration in the API dumps at the last release tag is missing from `colorpicker/api/`; run it before proposing an API change. It catches removed declarations and changed signatures, not a class losing a supertype, so that still needs a reviewer's eye.
21
+
Versioning follows [Semantic Versioning](https://semver.org): public API is added only in a minor release and removed or changed incompatibly only in a major one, and a patch leaves it alone. CI runs `scripts/check-api-removals.sh`, which fails when a declaration in the API dumps at the last release tag is missing from its module's `api/`; run it before proposing an API change. It catches removed declarations and changed signatures, not a class losing a supertype, so that still needs a reviewer's eye.
22
22
23
23
Our code style is defined via the [`.editorconfig`](.editorconfig) file at the repository root; most IDEs (including IntelliJ IDEA and Android Studio) pick it up automatically.
Copy file name to clipboardExpand all lines: README.md
+87-13Lines changed: 87 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
# anyColorPicker
4
4
5
-
Kotlin Multiplatform color picker library for Android, iOS, Desktop (JVM), and Web (Wasm), built with Compose Multiplatform and Material 3.
5
+
Kotlin Multiplatform color picker library for Android, iOS, Desktop (JVM), and Web (Wasm), built with Compose Multiplatform: ready-made Material 3 pickers, and the same pickers without Material for a design system of your own.
6
6
7
7
> **This README describes 2.0, which is not released yet.** The latest release is 1.2.1, documented at the [v1.2.1 tag](https://github.com/side-codes/anyColorPicker/tree/v1.2.1#readme). [Migrating from 1.x](#-migrating-from-1x) maps one API onto the other.
8
8
@@ -19,6 +19,7 @@ Kotlin Multiplatform color picker library for Android, iOS, Desktop (JVM), and W
19
19
- Alpha channel support
20
20
- Color picker dialog
21
21
- Material 3 theming via `ColorPickerDefaults` and `ColorPickerTheme`
22
+
- The same components without Material, as `Basic*` components that draw what their slots draw, for any other design system
22
23
- Accessibility semantics throughout — sliders step by each channel's own unit, and planes take focus, move with the arrow keys, and offer a screen reader one named action per direction
23
24
- Words and numbers from one `ColorPickerStrings`, with numbers in the device's format — `40 %` in French, `٤٠٪` in Egyptian Arabic; reword or translate by providing your own
24
25
- RTL layout support everywhere but the planes, which map a color space rather than showing progress
@@ -27,7 +28,7 @@ Kotlin Multiplatform color picker library for Android, iOS, Desktop (JVM), and W
|`codes.side:colorpicker-material3`| The Material 3 pickers, sliders, planes, swatch, dialog and theme, in `codes.side.colorpicker.material3`. |
54
+
|`codes.side:colorpicker-foundation`|`ColorPickerState`, in `codes.side.colorpicker.state`; the `Basic*` components and `ColorPickerStrings`, in `codes.side.colorpicker.foundation`. No Material. |
55
+
|`codes.side:color-compose`|`ColorValue.toComposeColor()` and `Color.toColorValue()`. |
56
+
|`codes.side:color`|`ColorValue`, the color spaces, conversion, gamut mapping, CSS strings and hex. No Compose. |
51
57
52
58
Published targets: `android`, `jvm`, `iosArm64`, `iosSimulatorArm64`, `wasmJs`.
53
59
@@ -589,8 +595,9 @@ keeps them. A string passed to a component still wins over the provided ones.
589
595
590
596
### Theming
591
597
592
-
All pickers and components accept `colors`, `shapes` and `dimensions` built with
593
-
`ColorPickerDefaults`; the colors and shapes derive from `MaterialTheme` by default:
598
+
Every slider, plane and picker accepts `colors`, `shapes` and `dimensions` built with
599
+
`ColorPickerDefaults`, and `ColorSwatch` its `colors` and a `shape`; the colors and shapes derive
600
+
from `MaterialTheme` by default:
594
601
595
602
```kotlin
596
603
ColorPicker(
@@ -625,6 +632,71 @@ whatever an enclosing `ColorPickerTheme` provided.
625
632
each class's `copy` does the same from one you already have, such as
626
633
`ColorPickerDefaults.currentColors()`.
627
634
635
+
### Without Material
636
+
637
+
`codes.side:colorpicker-foundation` holds the same components with no look of their own. Each draws
638
+
what its slots draw, and a slot reads what it needs from a scope: a slider's position, its color and
639
+
whether it is enabled, a plane's position, a channel slider's gradient. Dragging, the keyboard, a
640
+
screen reader and the picker's disabled state work as they do in the Material components, which are
|`HSLColorPickerSeekBar` (`hslMode` = hue/saturation/lightness) |`ChannelSlider(state, Hsl.H)`, `Hsl.S` or `Hsl.L`, or `HslColorPicker` for all three |
761
835
|`RGBColorPickerSeekBar`|`ChannelSlider(state, Srgb.R)`, `Srgb.G` or `Srgb.B`, or `RgbColorPicker`|
0 commit comments