A powerful and versatile color picker library for Jetpack Compose, offering multiple ways to select colors, including a classic HSL panel, an image-based dropper tool, and a ready-to-use dialog.
kolor-picker provides a suite of composables to handle all your color selection needs. It features
a standard KolorPicker with hue, saturation, and lightness controls, an ImageKolorPicker to
extract colors directly from a bitmap, and a pre-built KolorPickerDialog for quick and easy
integration. The library is built with a robust, hoistable state management system
(KolorPickerState) that makes it easy to control and observe color changes.
-
Classic HSL Color Picker (
KolorPicker):- A draggable saturation/lightness panel.
- A horizontal slider for hue selection.
- An optional horizontal slider for alpha/transparency.
- A live preview of the selected color with its
HEXandARGBcodes.
-
Image Dropper Tool (
ImageKolorPicker):- Pick a color directly from an
ImageBitmapby tapping or dragging. - A draggable handle indicates the exact pixel being sampled.
- The UI automatically adapts to the image's aspect ratio.
- Pick a color directly from an
-
Ready-to-Use Dialog (
KolorPickerDialog):- A pre-built, animated
AlertDialogthat wraps theKolorPickerorImageKolorPicker. - Comes with "Done", "Close" and optional "Reset" buttons.
- Handles its own visibility state and provides callbacks for color selection.
- A pre-built, animated
-
Robust State Management:
- Uses
rememberKolorPickerState()to create a hoistable, saveable state (KolorPickerState). KolorPickerStateholds theselectedColorand can be updated programmatically.
- Uses
-
Utility Features:
- Optional copy/paste buttons to interact with the system clipboard.
Groovy (build.gradle):
dependencies {
implementation 'com.github.bashpsk.emptylibs:kolor-picker:<latest-version>'
}Kotlin DSL (build.gradle):
dependencies {
implementation("com.github.bashpsk.emptylibs:kolor-picker:<latest-version>")
}Kotlin DSL with Version Catalogs:
[versions]
empty-libs = "<latest-version>"
[libraries]
emptylibs-kolor-picker = { group = "com.github.bashpsk.emptylibs", name = "kolor-picker", version.ref = "empty-libs" }dependencies {
implementation(libs.emptylibs.kolor.picker)
}Use this for a standard HSL-based color selection UI.
val colorPickerState = rememberKolorPickerState(initialColor = MaterialTheme.colorScheme.primary)
KolorPicker(
state = colorState,
enableAlphaPanel = true, // Enable transparency slider
enableCopyButtons = true // Show copy/paste buttons
)
Box(
modifier = Modifier
.size(64.dp)
.background(colorPickerState.selectedColor)
)Use this to let users pick a color directly from an image.
val colorPickerState = rememberKolorPickerState()
ImageKolorPicker(
imageBitmap = sourceBitmap,
state = colorPickerState
)
Box(
modifier = Modifier
.size(64.dp)
.background(colorPickerState.selectedColor)
)val dialogVisibleState = remember { MutableTransitionState(false) }
val colorPickerState = rememberKolorPickerState()
// Button to open the dialog
Button(onClick = { dialogVisibleState.targetState = true }) {
Text("Choose Color")
}
// The dialog itself
KolorPickerDialog(
dialogVisibleState = dialogVisibleState,
state = colorPickerState,
onSelectedColor = { newColor ->
// Handle the final selected color
}
)
// Image Color Picker Dialog
KolorPickerDialog(
dialogVisibleState = dialogVisibleState,
state = colorPickerState,
imageBitmap = baseImage,
onSelectedColor = { newColor ->
// Handle the final selected color
}
)| Color Picker - UI | Color Picker - Dialog |
|---|---|
![]() |
![]() |
kolor_picker.mp4
kolor_picker_dialog.mp4
| Image Color Picker - UI | Image Color Picker - Dialog |
|---|---|
![]() |
![]() |



