Code Monkey home page Code Monkey logo

colours-for-ios's Introduction

Colours for iOS

A beautiful set of 100 predefined UIColors, and UIColor methods, ready to use in your next iOS project.

ScreenShotScreenShot

Installation

Drag the included Colours.h and Colours.m files into your project. They are located in the top-level directory. You can see a demo of how to use these with the included Xcode project as well.

Import Colours.h into your ViewController.h file, and that's it.

Using Colours

It's very simple. Whenever you set a property that is a UIColor, like self.view.backgroundColor, instead of doing something like self.view.backgroundColor = [UIColor redColor] use one of the new colors like so self.view.backgroundColor = ColorTeal

System Colors

  • ColorInfoBlue
  • ColorSuccess
  • ColorWarning
  • ColorDanger

Whites

  • ColorAntiqueWhite
  • ColorOldLace
  • ColorIvory
  • ColorSeashell
  • ColorGhostWhite
  • ColorSnow
  • ColorLinen

Grays

  • Color25PercentBlack
  • Color50PercentBlack
  • Color75PercentBlack
  • ColorWarmGray
  • ColorCoolGray
  • ColorCharcoal

Blues

  • ColorTeal
  • ColorSteelBlue
  • ColorRobinEgg
  • ColorPastelBlue
  • ColorTurquoise
  • ColorSkyBlue
  • ColorIndigo
  • ColorDenim
  • ColorBlueberry
  • ColorCornflower
  • ColorBabyBlue
  • ColorMidnightBlue
  • ColorFadedBlue
  • ColorIceberg
  • ColorWave

Greens

  • ColorEmerald
  • ColorGrass
  • ColorPastelGreen
  • ColorSeafoam
  • ColorPaleGreen
  • ColorCactusGreen
  • ColorChartreuse
  • ColorHollyGreen
  • ColorOlive
  • ColorOliveDrab
  • ColorMoneyGreen
  • ColorHoneydew
  • ColorLime
  • ColorCardTable

Reds

  • ColorSalmon
  • ColorBrickRed
  • ColorEasterPink
  • ColorGrapefruit
  • ColorPink
  • ColorIndianRed
  • ColorStrawberry
  • ColorCoral
  • ColorMaroon
  • ColorWatermelon
  • ColorTomato
  • ColorPinkLipstick
  • ColorPaleRose
  • ColorCrimson

Purples

  • ColorEggplant
  • ColorPastelPurple
  • ColorPalePurple
  • ColorCoolPurple
  • ColorViolet
  • ColorPlum
  • ColorLavender
  • ColorRaspberry
  • ColorFuschia
  • ColorGrape
  • ColorPeriwinkle
  • ColorOrchid

Yellows

  • ColorGoldenrod
  • ColorYellowGreen
  • ColorBanana
  • ColorMustard
  • ColorButtermilk
  • ColorGold
  • ColorCream
  • ColorLightCream
  • ColorWheat
  • ColorBeige

Oranges

  • ColorPeach
  • ColorBurntOrange
  • ColorPastelOrange
  • ColorCantaloupe
  • ColorCarrot
  • ColorMandarin

Browns

  • ColorChiliPowder
  • ColorBurntSienna
  • ColorChocolate
  • ColorCoffee
  • ColorCinnamon
  • ColorAlmond
  • ColorEggshell
  • ColorCoffee
  • ColorSand
  • ColorMud
  • ColorSienna
  • ColorDust

Colours Methods

You can grab a UIColor from a hexString by calling colorFromHex:

UIColor *newColor = [Colours colorFromHex:@"#f587e4"];

You can also grab a Hex string by calling hexFromColor:

NSString *hexString = [Colours hexFromColor:ColorRobinEgg];
// Output: #8ddaf7

If you'd like the RGBA values of any UIColor, just call the rgbaArrayFromColor method. It returns an array of 4 NSNumbers, RGBA - in that order. Here's how you'd call this:

NSArray *colorArray = [Colours rgbaArrayFromColor:self.view.backgroundColor];
float r = [colorArray[0] floatValue];
float g = [colorArray[1] floatValue];
float b = [colorArray[2] floatValue];
float a = [colorArray[3] floatValue];

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 NSArray of 4 new UIColor objects to create a pretty nice color scheme that complements the root color you passed in.

NSArray *colorScheme = [Colours generateColorSchemeFromColor:(UIColor *)color ofType:ColorSchemeType];

ColorSchemeTypes

  • ColorSchemeAnalagous
  • ColorSchemeMonochromatic
  • ColorSchemeTriad
  • ColorSchemeComplementary

Reap What I Sow!

This project is distributed under the standard MIT License. Please use this and twist it in whatever fashion you wish - and recommend any cool changes to help the code.

colours-for-ios's People

Contributors

bennyguitar avatar

Watchers

 avatar  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.