Skip to content

For color lovers! A simple but powerful Android color picker

License

Notifications You must be signed in to change notification settings

naseemakhtar994/ColorBox-library

Repository files navigation

ColorBox library

Download

[Android Arsenal

Features

  • Dynamic color preview;
  • Change color Alpha Red Green and Blue sliders;
  • Clearable recent colors;
  • Material palettes (>200 colors!);
  • ColorBox preference;
  • 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

Standalone app

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

Get it on Google Play

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.0.3'
}
  • For gradle versions < 3.0 use 'compile' configuration:
dependencies {
    // ... other dependencies here
    compile 'com.github.enricocid:cbl:1.0.3'
}

Usage

To display the color box simply:

ColorBox.showColorBox(String tag, Activity activity);

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

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.

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!

About

For color lovers! A simple but powerful Android color picker

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages