Popularity
2.1
Stable
Activity
0.0
Declining
52
6
14

Description

Features - Dynamic color preview; - Change color Alpha Red Green and Blue sliders; - Clearable recent colors; - Material palettes (>200 colors!); - ColorBox preference; - Easy to implement;

Programming language: Java
Tags: Material     Colors     Color Picker     Palette    

ColorBox library alternatives and similar packages

Based on the "Colors" category.
Alternatively, view ColorBox library alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of ColorBox library or a related project?

Add another 'Colors' Package

README

64px

DEPRECATED

Credits for the logo goes to Hafiz Ahmmed (https://github.com/hafizahmmed)

ColorBox library

Download Android Arsenal API

Features

  • Dynamic color preview;
  • Change the color through Alpha, Red, Green, and Blue sliders;
  • Clearable recent colors;
  • Material palettes (>200 colors!);
  • ColorBox preference;
  • Themes (Light, Dark, Black);
  • Easy to implement;

ScreenShot

Sample Project

You can download the latest sample APK from this repo here: https://github.com/enricocid/ColorBox-library/blob/master/files/release/app-release.apk

Gradle Dependency

Repository

The Gradle dependency is available via jCenter. jCenter is the default Maven repository used by Android Studio.

The minimum API level supported by this library is API 21 (Lollipop).

Download

  • If You are using gradle:3.0+ You should use 'implementation' configuration. Add the following dependency to your project's build.gradle:
dependencies {
    // ... other dependencies here
    implementation 'com.github.enricocid:cbl:1.1.1'
}
  • For gradle versions < 3.0 use 'compile' configuration:
dependencies {
    // ... other dependencies here
    compile 'com.github.enricocid:cbl:1.1.1'
}

Usage

To display the color box simply:

ColorBox.showColorBox(String tag, Activity activity, int theme);

tag: it's a string used to identify the ColorBox.

theme: Possible values are:

ScreenShot

  • ColorBox.LIGHT;
  • ColorBox.DARK;
  • ColorBox.BLACK;

Usage instructions for Preferences

ScreenShot

In Your preferences XML add:

<com.github.colorbox.ColorBoxPreference android:key="the_key_u_want" android:title="@string/your_string"/>

note: don't forget to add a (different) key and a title for every ColorBoxPreference You add in Your preferences XML.

You can set the theme of the ColorBox by adding the setTheme attribute. The possible values are 1 and 2. The default value is 0, corresponding to the light theme (You don't need to specify this attribute if You want to keep the light theme).

  • For Dark theme (1):
<com.github.colorbox.ColorBoxPreference
app:setTheme="1"
android:key="the_key_u_want" android:title="@string/your_string"/>
  • For Black theme (2):
<com.github.colorbox.ColorBoxPreference 
app:setTheme="2"
android:key="the_key_u_want" android:title="@string/your_string"/>

In You Preference fragment (onResume) add this

@Override
    public void onResume() {
        super.onResume();

        ColorBox.registerPreferenceUpdater(Activity activity);
    }

To retrieve the color:

int color = ColorBox.getColor(String tag, Context context);

Utilities:

ColorBox.getComplementaryColor(int colorToInvert)

Returns inverted color:

ScreenShot

ColorBox.getHexadecimal(int color)

Returns the hexadecimal code from color.

ColorBox.isColorDark(int color)

Determine if the color is dark or light.

THAT'S ALL FOLKS!