ColorPicker

Additional

Language
Kotlin
Version
v1.2.1 (Jul 16, 2020)
Created
Dec 26, 2019
Updated
Sep 17, 2020
Owner
Dhaval Patel (Dhaval2404)
Contributors
Dhaval Patel (Dhaval2404)
Marc Auberer (marcauberer)
2
Activity
Badge
Generate
Download
Source code
APK file

Commercial

🎨Color Picker Library for Android

Built with ❤︎ by Dhaval Patel and contributors

Yet another Color Picker Library for Android. It is highly customizable and easy to use. Pick the color from wheel or select Material Colors from dialog. The original ColorPickerView was written by Hong Duan.



  • The ColorPicker configuration is created using the builder pattern.

    ColorPickerDialog
        .Builder(activity)           // Pass Activity Instance
        .setColorShape(ColorShape.SQAURE)   // Default ColorShape.CIRCLE
        .setDefaultColor(mColor)         // Pass Default Color
        .setColorListener { color, colorHex ->
         // Handle Color Selection
        }
        .show()
  • The MaterialColorPicker configuration is created using the builder pattern.

    MaterialColorPickerDialog
        .Builder(activity)            // Pass Activity Instance
        .setColorShape(ColorShape.SQAURE)    // Default ColorShape.CIRCLE
        .setColorSwatch(ColorSwatch._300)    // Default ColorSwatch._500
        .setDefaultColor(mMaterialColorSquare)  // Pass Default Color
        .setColorListener { color, colorHex ->
         // Handle Color Selection
        }
        .show()
  • 🎨Customization

    • You can change title of the Dialog

      MaterialColorPickerDialog
        .Builder(activity)           // Pass Activity Instance
        .setTitle("Pick Theme")               // Change Dialog Title
        .setColorListener { color, colorHex ->
            // Handle Color Selection
        }
        .show()
    • You can change the color or Positive and Negative Button Text Color. Add Following parameters in your colors.xml file.

      <resources>
          <!-- Here you can add color of your choice  -->
          <color name="positiveButtonTextColor">@color/colorAccent</color>
          <color name="negativeButtonTextColor">@color/colorAccent</color>
          <color name="bottomSheetDividerColor">#F5F5F5</color>
      </resources>
    • You can provide predefine colors for the MaterialColorPicker

       MaterialColorPickerDialog
           .Builder(activity)           // Pass Activity Instance
           .setColors(       // Pass Predefined Hex Color
               arrayListOf(
               "#f6e58d", "#ffbe76", "#ff7979", "#badc58", "#dff9fb",
               "#7ed6df", "#e056fd", "#686de0", "#30336b", "#95afc0"
               )
           )
           .setColorListener { color, colorHex ->
               // Handle Color Selection
           }
           .show()

      or

      MaterialColorPickerDialog
          .Builder(activity)           // Pass Activity Instance
          .setColorRes(resources.getIntArray(R.array.themeColors).toList()) // Pass Predefined Hex Color
          .setColorListener { color, colorHex ->
              // Handle Color Selection
          }
          .show()

      Where R.array.themeColors is defined as below

      <array name="themeColors">
        <item>@color/green_500</item>
        <item>@color/blue_500</item>
        <item>@color/red_500</item>
        <item>@color/grey_500</item>
        <item>@color/orange_500</item>
      </array>

    💥Compatibility

    • Library - Android Lollipop 5.0+ (API 21)
    • Sample - Android Lollipop 5.0+ (API 21)

    ✔️Changelog

    Version: 1.2

    • Added Dark mode support & German translation #4

    Version: 1.1

    • Added option to change positive and negative button text color #2

    Version: 1.0

    • Initial Build

    📃 Libraries Used

    Let us know!

    We'll be really happy if you sent us links to your projects where you use our component. Just send an email to dhavalpatel244@gmail.com And do let us know if you have any questions or suggestion regarding the library.

    License

    Copyright 2020, Dhaval Patel
    
    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.