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;
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.
-
ColorPicker
🎨 A color picker for Android. Pick a color using color wheel and slider (HSV & alpha). -
Material-Resources-Library
A list of most useful resources for designing android apps such as all material colors and dimens, 180 Gradient background + html, social, flat, fluent, metro colors.
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ColorBox library or a related project?
README
DEPRECATED
Credits for the logo goes to Hafiz Ahmmed (https://github.com/hafizahmmed)
ColorBox library
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;
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:
- ColorBox.LIGHT;
- ColorBox.DARK;
- ColorBox.BLACK;
Usage instructions for Preferences
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:
ColorBox.getHexadecimal(int color)
Returns the hexadecimal code from color.
ColorBox.isColorDark(int color)
Determine if the color is dark or light.