Skip to content
/ Colours Public
forked from MatthewYork/Colours

A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

License

Notifications You must be signed in to change notification settings

iamima/Colours

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScreenShot

Colours is a port of the Colours Library for iOS made by my good friend Ben Gordon. You can find that project here.

Installation

  • Import the Colours library into your workspace, found in the ColoursLibrary Folder.
  • Right-click on your android project folder and click on the project properties.
  • Click on the "Android" tab and then "Add" under the Library section.
  • Select the ColoursLibrary project to link it with your project

Color Palette

infoBlueColorinfoBlueColorsuccessColorsuccessColorwarningColorwarningColor
dangerColordangerColorantiqueWhiteColorantiqueWhiteColoroldLaceColoroldLaceColor
ivoryColorivoryColorseashellColorseashellColorghostWhiteColorghostWhiteColor
snowColorsnowColorlinenColorlinenColorblack25PercentColorblack25PercentColor
black50PercentColorblack50PercentColorblack75PercentColorblack75PercentColorwarmGrayColorwarmGrayColor
coolGrayColorcoolGrayColorcharcoalColorcharcoalColortealColortealColor
steelBlueColorsteelBlueColorrobinEggColorrobinEggColorpastelBlueColorpastelBlueColor
turquoiseColorturquoiseColorskyBlueColorskyBlueColorindigoColorindigoColor
denimColordenimColorblueberryColorblueberryColorcornflowerColorcornflowerColor
babyBlueColorbabyBlueColormidnightBlueColormidnightBlueColorfadedBlueColorfadedBlueColor
icebergColoricebergColorwaveColorwaveColoremeraldColoremeraldColor
grassColorgrassColorpastelGreenColorpastelGreenColorseafoamColorseafoamColor
paleGreenColorpaleGreenColorcactusGreenColorcactusGreenColorchartreuseColorchartreuseColor
hollyGreenColorhollyGreenColoroliveColoroliveColoroliveDrabColoroliveDrabColor
moneyGreenColormoneyGreenColorhoneydewColorhoneydewColorlimeColorlimeColor
cardTableColorcardTableColorsalmonColorsalmonColorbrickRedColorbrickRedColor
easterPinkColoreasterPinkColorgrapefruitColorgrapefruitColorpinkColorpinkColor
indianRedColorindianRedColorstrawberryColorstrawberryColorcoralColorcoralColor
maroonColormaroonColorwatermelonColorwatermelonColortomatoColortomatoColor
pinkLipstickColorpinkLipstickColorpaleRoseColorpaleRoseColorcrimsonColorcrimsonColor
eggplantColoreggplantColorpastelPurpleColorpastelPurpleColorpalePurpleColorpalePurpleColor
coolPurpleColorcoolPurpleColorvioletColorvioletColorplumColorplumColor
lavenderColorlavenderColorraspberryColorraspberryColorfuschiaColorfuschiaColor
grapeColorgrapeColorperiwinkleColorperiwinkleColororchidColororchidColor
goldenrodColorgoldenrodColoryellowGreenColoryellowGreenColorbananaColorbananaColor
mustardColormustardColorbuttermilkColorbuttermilkColorgoldColorgoldColor
creamColorcreamColorlightCreamColorlightCreamColorwheatColorwheatColor
beigeColorbeigeColorpeachColorpeachColorburntOrangeColorburntOrangeColor
pastelOrangeColorpastelOrangeColorcantaloupeColorcantaloupeColorcarrotColorcarrotColor
mandarinColormandarinColorchiliPowderColorchiliPowderColorburntSiennaColorburntSiennaColor
chocolateColorchocolateColorcoffeeColorcoffeeColorcinnamonColorcinnamonColor
almondColoralmondColoreggshellColoreggshellColorsandColorsandColor
mudColormudColorsiennaColorsiennaColordustColordustColor

Using Predefined Colors

Colours works exactly like the predefined Android colors. In fact, the Colour class is a subclass of android.graphics.Color, so you can actually use the Colour class where you normally use Color to gain access to the cool new methods of the Colour Library without losing any methods in the Color class.

###XML

To user your HUGE new palette of colors in XML, reference a color just as you would a color in a local Color.xml resource file:

  <View
    .
    .
    .
    android:background="@color/seafoamColor" />

Huzzah! Colours automagically integrates all of its colors to your project, just as if you had defined them yourself. (You can tell all your friends that you made them. We won't tell!)

###Code

Let's say, however, that you would like to set the color of something in code. Colours has you covered. Every single color available in XML is also avalable as a static method, much like the android system colors. To retrieve a predefined color's int representation, simply call it's corresponding method:

int seashellColor = Colour.seashellColor();

Color Helper Methods

Beyond giving you a list of a ton of colors with no effort, this category also gives you some methods that allow different color manipulations and translations. Here's how you use these:

Generating white or black that contrasts with a UIColor

A lot of times you may want to put text on top of a view that is a certain color, and you want to be sure that it will look good on top of it. With this method you will return either white or black, depending on the how well each of them contrast on top of it. Here's how you use this:

int contrastingColor = Colour.blackOrWhiteContrastingColor(inputColor)

Generating a complementary color

This method will create a color int that is the exact opposite color from another color int on the color wheel. The same saturation and brightness are preserved, just the hue is changed.

int complementaryColor = Colour.complementaryColor(inputColor);

Generating Color Schemes

You can create a 5-color scheme based off of a UIColor using the following method. It takes in a UIColor and one of the ColorSchemeTypes defined in Colours. It returns an int[] of 4 new colors to create a pretty nice color scheme that complements the root color you passed in.

int[] complementaryColors = Colour.colorSchemeOfType(inputColor, ColorScheme.ColorSchemeComplementary);

ColorSchemeTypes

  • ColorSchemeAnalagous
  • ColorSchemeMonochromatic
  • ColorSchemeTriad
  • ColorSchemeComplementary

Here are the different examples starting with a color scheme based off of Colour.seafoamColor().

ColorSchemeAnalagous

Analagous

ColorSchemeMonochromatic

Monochromatic

ColorSchemeTriad

Triad

ColorSchemeComplementary

Complementary

Credits

License

The MIT License (MIT)

Copyright (c) 2014 Matthew York

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published