Skip to content

vadiole/colorpicker

Repository files navigation

maven central

Color Picker — beautiful library for Android

screenshot 1screenshot 2screenshot 3screenshot 4screenshot 5screenshot 6screenshot 7screenshot 8

Features

  • Simple dialog builder
  • RGB & HSV color models, with optional alpha channel
  • Dark theme support
  • Sliders with gradient background
  • Switch color models in runtime

Download

Kotlin DSL:

implementation("io.github.vadiole:colorpicker:1.0.4")

Groove:

implementation 'io.github.vadiole:colorpicker:1.0.4'

Usage

// Create dialog
val colorPicker: ColorPickerDialog = ColorPickerDialog.Builder()

    // Set initial (default) color
    .setInitialColor(currentColor)

    // Set Color Model, can be ARGB, RGB, AHSV or HSV
    .setColorModel(ColorModel.HSV)

    // Set is user be able to switch color model
    .setColorModelSwitchEnabled(true)

    // Set your localized string resource for OK button
    .setButtonOkText(android.R.string.ok)

    // Set your localized string resource for Cancel button
    .setButtonCancelText(android.R.string.cancel)

    // Callback for picked color (required)
    .onColorSelected { color: Int ->
        // Use color
    }

    // Create dialog
    .create()

// Show dialog from Activity
colorPicker.show(supportFragmentManager, "color_picker")

// Show dialog from Fragment
colorPicker.show(childFragmentManager, "color_picker")