
Material 3–style color picker components offering HSL, RGB, CMYK, LAB and perceptual Okhsl/Okhsv/Oklab/Oklch models, CSS Color‑4 gamut mapping, alpha, zero‑drift state, accessibility.
anyColorPicker is a color picker library for Kotlin Multiplatform and Compose Multiplatform, on Android, iOS, desktop (JVM) and the web (Wasm): ready-made Material 3 pickers, and the same pickers without Material for a design system of your own. On Android it is a Jetpack Compose color picker: an Android-only app adds one dependency and needs no Kotlin Multiplatform setup.
This README describes 2.0. 1.x is documented at the v1.2.0 tag, and Migrating from 1.x maps one API onto the other.
| Okhsl | OkLCh | HSV | CMYK |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Every picker, in both coloring modes: Gallery.
ColorPickerState, a ColorValue or a Compose Color
ColorValue keeps the space it was written in, its none components and any value outside sRGBColorPickerDefaults and ColorPickerTheme
Basic* components that draw what their slots draw, for any other design systemColorPickerStrings, with numbers in the device's format — 40 % in French, ٤٠٪ in Egyptian Arabic; reword or translate by providing your own// build.gradle.kts
implementation("codes.side:colorpicker-material3:2.0.0")In a Kotlin Multiplatform project, add it to commonMain:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("codes.side:colorpicker-material3:2.0.0")
}
}
}On a design system other than Material, depend on codes.side:colorpicker-foundation instead: see
Without Material. The artifacts, targets and requirements are in Setup and requirements.
import codes.side.color.Okhsl
import codes.side.colorpicker.material3.ColorPicker
import codes.side.colorpicker.material3.ColorSwatch
import codes.side.colorpicker.state.rememberSaveableColorPickerState
@Composable
fun MyScreen() {
val state = rememberSaveableColorPickerState(Okhsl(250.0, 0.8, 0.6))
Column {
ColorPicker(state)
ColorSwatch(color = state.color, modifier = Modifier.size(48.dp))
}
}ColorPicker is an Okhsl picker unless given a space: its lightness is perceived lightness and
its saturation is measured against sRGB, so every position is a color sRGB shows, bar a sliver just
past pure blue.
ColorPicker(state, space = Oklch) picks in any other space, and the named pickers,
HslColorPicker to CmykColorPicker, fix one.
A picker can equally sit over a value you hold yourself:
import codes.side.colorpicker.material3.HslColorPicker
var color by remember { mutableStateOf(Color(0xFF3366CC)) }
HslColorPicker(color = color, onColorChange = { color = it })The full documentation is at side-codes.github.io/anyColorPicker:
Copyright 2020 Illia Achour
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
anyColorPicker is a color picker library for Kotlin Multiplatform and Compose Multiplatform, on Android, iOS, desktop (JVM) and the web (Wasm): ready-made Material 3 pickers, and the same pickers without Material for a design system of your own. On Android it is a Jetpack Compose color picker: an Android-only app adds one dependency and needs no Kotlin Multiplatform setup.
This README describes 2.0. 1.x is documented at the v1.2.0 tag, and Migrating from 1.x maps one API onto the other.
| Okhsl | OkLCh | HSV | CMYK |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
Every picker, in both coloring modes: Gallery.
ColorPickerState, a ColorValue or a Compose Color
ColorValue keeps the space it was written in, its none components and any value outside sRGBColorPickerDefaults and ColorPickerTheme
Basic* components that draw what their slots draw, for any other design systemColorPickerStrings, with numbers in the device's format — 40 % in French, ٤٠٪ in Egyptian Arabic; reword or translate by providing your own// build.gradle.kts
implementation("codes.side:colorpicker-material3:2.0.0")In a Kotlin Multiplatform project, add it to commonMain:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("codes.side:colorpicker-material3:2.0.0")
}
}
}On a design system other than Material, depend on codes.side:colorpicker-foundation instead: see
Without Material. The artifacts, targets and requirements are in Setup and requirements.
import codes.side.color.Okhsl
import codes.side.colorpicker.material3.ColorPicker
import codes.side.colorpicker.material3.ColorSwatch
import codes.side.colorpicker.state.rememberSaveableColorPickerState
@Composable
fun MyScreen() {
val state = rememberSaveableColorPickerState(Okhsl(250.0, 0.8, 0.6))
Column {
ColorPicker(state)
ColorSwatch(color = state.color, modifier = Modifier.size(48.dp))
}
}ColorPicker is an Okhsl picker unless given a space: its lightness is perceived lightness and
its saturation is measured against sRGB, so every position is a color sRGB shows, bar a sliver just
past pure blue.
ColorPicker(state, space = Oklch) picks in any other space, and the named pickers,
HslColorPicker to CmykColorPicker, fix one.
A picker can equally sit over a value you hold yourself:
import codes.side.colorpicker.material3.HslColorPicker
var color by remember { mutableStateOf(Color(0xFF3366CC)) }
HslColorPicker(color = color, onColorChange = { color = it })The full documentation is at side-codes.github.io/anyColorPicker:
Copyright 2020 Illia Achour
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.