Coder Social home page Coder Social logo

zhuixinjian / colours-for-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bennyguitar/colours

0.0 1.0 0.0 531 KB

A collection of predefined UIColors you can use in your apps. Just include the Colours.h/.m files and you'll have a slew of new colors to use.

License: MIT License

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 UIColor+Colours.h and UIColor+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 UIColor+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, use one of the new colors as you would the system colors. So, instead of: self.view.backgroundColor = [UIColor redColor] do something like this: self.view.backgroundColor = [UIColor tomatoColor]

System Colors

  • infoBlueColor
  • successColor
  • warningColor
  • dangerColor

Whites

  • antiqueWhiteColor
  • oldLaceColor
  • ivoryColor
  • seashellColor
  • ghostWhiteColor
  • snowColor
  • linenColor

Grays

  • black25PercentColor
  • black50PercentColor
  • black75PercentColor
  • warmGrayColor
  • coolGrayColor
  • charcoalColor

Blues

  • tealColor
  • steelBlueColor
  • robinEggColor
  • pastelBlueColor
  • turquoiseColor
  • skyBlueColor
  • indigoColor
  • denimColor
  • blueberryColor
  • cornflowerColor
  • babyBlueColor
  • midnightBlueColor
  • fadedBlueColor
  • icebergColor
  • waveColor

Greens

  • emeraldColor
  • grassColor
  • pastelGreenColor
  • seafoamColor
  • paleGreenColor
  • cactusGreenColor
  • chartreuseColor
  • hollyGreenColor
  • oliveColor
  • oliveDrabColor
  • moneyGreenColor
  • honeydewColor
  • limeColor
  • cardTableColor

Reds

  • salmonColor
  • brickRedColor
  • easterPinkColor
  • grapefruitColor
  • pinkColor
  • indianRedColor
  • strawberryColor
  • coralColor
  • maroonColor
  • watermelonColor
  • tomatoColor
  • pinkLipstickColor
  • paleRoseColor
  • crimsonColor

Purples

  • eggplantColor
  • pastelPurpleColor
  • palePurpleColor
  • coolPurpleColor
  • violetColor
  • plumColor
  • lavenderColor
  • raspberryColor
  • fuschiaColor
  • grapeColor
  • periwinkleColor
  • orchidColor

Yellows

  • goldenrodColor
  • yellowGreenColor
  • bananaColor
  • mustardColor
  • buttermilkColor
  • goldColor
  • creamColor
  • lightCreamColor
  • wheatColor
  • beigeColor

Oranges

  • peachColor
  • burntOrangeColor
  • pastelOrangeColor
  • cantaloupeColor
  • carrotColor
  • mandarinColor

Browns

  • chiliPowderColor
  • burntSiennaColor
  • chocolateColor
  • coffeeColor
  • cinnamonColor
  • almondColor
  • eggshellColor
  • coffeeColor
  • sandColor
  • mudColor
  • siennaColor
  • dustColor

Colours Methods

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

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

You can also grab a Hex string by calling hexString:

NSString *hexString = [color hexString];
// 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 = [self.view.backgroundColor rgbaArray];
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 = [color generateColorSchemeOfType:ColorSchemeType];

ColorSchemeTypes

  • ColorSchemeAnalagous
  • ColorSchemeMonochromatic
  • ColorSchemeTriad
  • ColorSchemeComplementary

CocoaPods

pod 'Colours', '~> 2.0'

For help setting up and maintaining dependencies using CocoaPods check out this link: http://cocoapods.org/

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 jksk avatar pridechung avatar

Watchers

 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.