- Dynamic color preview;
- Change the color through Alpha, Red, Green, and Blue sliders;
- Clearable recent colors;
- Material palettes (>200 colors!);
- ColorBox preference;
- Easy to implement;
You can download the latest sample APK from this repo here: https://github.com/enricocid/ColorBox-library/blob/master/files/release/app-release.apk
If You want to try the ColorBox here is also a standalone version of the homonym library. It has the same features, in addition You can apply colors as solid wallpapers or copy the hex color code to clipboard :D
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).
- 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.0.3'
}
- For gradle versions < 3.0 use 'compile' configuration:
dependencies {
// ... other dependencies here
compile 'com.github.enricocid:cbl:1.0.3'
}
ColorBox.showColorBox(String tag, Activity activity);
tag: it's a string used to identify the ColorBox.
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.
In You Preference fragment (onResume) add this
@Override
public void onResume() {
super.onResume();
ColorBox.registerPreferenceUpdater(Activity activity);
}
int color = ColorBox.getColor(String tag, Context context);
Returns inverted color:
Returns the hexadecimal code from color.
Determine if the color is dark or light.