Color Picker — beautiful library for Android

maven centralgithub

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

Features

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")      

License

Copyright 2021 vadiole

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.