Code Monkey home page Code Monkey logo

colorbox-library's Introduction

ColorBox library

Download

Android Arsenal

Features

  • 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;

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!

colorbox-library's People

Contributors

enricocid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.