Git Product home page Git Product logo

kevinschildhorn / colordynamo Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 1.0 169 KB

Color Dynamo is an Android library that lets developers create styles and themes that can be changed dynamically. The library allows setting both background colors and text colors dynamically, as well as saving and loading "styles". The library includes two styles by default, dark and light.

Java 100.00%
android java theme style library color

colordynamo's Introduction

ColorDynamo

Color Dynamo is an Android library that lets developers create styles and themes that can be changed dynamically. The library allows setting both background colors and text colors dynamically, as well as saving and loading "styles". The library includes two styles by default, dark and light.

Note: These are not standard Android styles and themes.

Backgound colors include:

  • Primary color
  • Secondary color
  • Accent Color
  • Navigation Bar Color
  • Button Color
  • Selected color

Text colors include:

  • Primary Text color
  • Secondary Text color
  • Navigation Item Color
  • Button Text Color.

Installation

To include the library in your project, add these lines of code. (These will be changed soon)

In the project build.gradle:

maven {
    url  "https://dl.bintray.com/kevinschildhorn/ColorDynamo"
}

In the module build.gradle:

compile(group: 'org.kevinschildhorn', name: 'colordynamo', version: '1.0.0', ext: 'aar', classifier: '')

To use ColorDynamo your Activities must extend CAActivity and your fragments must extend CAFragment.

CAActivity

Here is where you can set styles. There are also animated versions of these functions that will change the current style to the new style over the time duration.

To set the style to dark

void setStyleDefaultDark()
void animateStyleDefaultDark(int duration)

To set the style to light

void setStyleDefaultLight()
void animateStyleDefaultLight(int duration)

To set a custom style

void setStyleRes(int primRes, int secRes, int accRes, int primTextRes, int secTextRes)
void setStyle(int prim, int sec,int acc, int primText, int secText)

To refresh the activity (note this should be done automatically when entering the activity. Use this when loading or changing a style)

void repaintActivity()
void repaintActivityAnimated(int duration)

CAColors

CAColors is a singleton model. It is used to save and load existing styles.

Getting singleton

getInstance(Context ctx)    // Note: Context is only required on first time use.

Saving/Loading Styles by name

void saveStyle(String name)
boolean loadStyle(String name)    // boolean returns whether it was successful or not

Removing styles

void removeStyle(String name)
void removeAllStyles()

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.