Skip to content

UIColor - Swift Extension. A delightful UIColor extension written in Swift for convenience purposes

License

Notifications You must be signed in to change notification settings

jianyaoang/UIColor-Swift-Extension

Repository files navigation

UIColor-Swift-Extension

A UIColor Extension written in Swift for convenience purposes.

ScreenShot

This extension:

  1. Saves your time from converting Hex codes to RGB colors manually
  2. Gives you access to more standard or sophisticated colors with much convenience
  3. Provides you with awesome sample gradient background colors AND easy way to customize your own!

How to use:

1. Drop this extension file into your Swift project 2. Instantiate UIColor 3. Implement the delightful methods!

Example1
let superAwesomeColor = UIColor()
self.view.backgroundColor = superAwesomeColor.convertHexStringToColor("Insert the hex color code string here")

Example2
let amazingColor = UIColor()
self.view.backgroundColor = amazingColor.convertHexToRGB(Insert your UInt32 Color Hex Code here)

Example3
let delightfulColor = UIColor()
self.view.backgroundColor = delightfulColor.Insert the delightful colors name()

The gradient feature in this extension changes the background of the specified view to your choice of gradient. Example 4 and 5 are sample usage of the gradient feature.
Example4
let exquisiteGradient = UIColor()
let backgroundView: UIView = exquisiteGradient.Insert name of gradient(Insert targeted view ex. self.view)

Example5
let beautifulGradient = UIColor()
self.view = beautifulGradient.theGradientBackground(self.view, hexColor1: Insert hex color string ex. "eef2f3", hexColor2: Insert hex color string ex. "70e1f5")

Delightful colors:

Colors name | Sample color image ------------ | ------------------ Crimson | ![ScreenShot](/screenshots/crimson.png) Lavender Blush | ![ScreenShot](/screenshots/lavenderBlush.png) Greyish Pink | ![ScreenShot](/screenshots/greyishPink.png) Indigo | ![ScreenShot](/screenshots/indigo.png) Midnight Blue | ![ScreenShot](/screenshots/midnightBlue.png) Light Sky Blue | ![ScreenShot](/screenshots/lightSkyBlue.png) Deep Sky Blue | ![ScreenShot](/screenshots/deepSkyBlue.png) Navy | ![ScreenShot](/screenshots/navy.png) Royal Blue | ![ScreenShot](/screenshots/royalBlue.png) Turquoise | ![ScreenShot](/screenshots/turquoise.png) Darker Turquoise | ![ScreenShot](/screenshots/darkerdarkerTurquoise.png) Spring Green | ![ScreenShot](/screenshots/springGreen.png) Darker Spring Green | ![ScreenShot](/screenshots/darkerSpringGreen.png) Mint | ![ScreenShot](/screenshots/mint.png) Lime Green | ![ScreenShot](/screenshots/limeGreen.png) Forest Green | ![ScreenShot](/screenshots/forestGreen.png) Rosy Brown | ![ScreenShot](/screenshots/rosyBrown.png) Darker Rosy Brown | ![ScreenShot](/screenshots/darkerRosyBrown.png) Light Coral | ![ScreenShot](/screenshots/lightCoral.png) Indian Red | ![ScreenShot](/screenshots/indianRed.png) Darker Indian Red | ![ScreenShot](/screenshots/darkerIndianRed.png) Fire Brick | ![ScreenShot](/screenshots/fireBrick.png) Silver | ![ScreenShot](/screenshots/silver.png) Dim Gray | ![ScreenShot](/screenshots/dimGray.png)

Gradient Colors

You can create your own gradient colors as seen in Example 5. However, this extension has some sweet gradient background available:

Name of Gradient Gradient
FieryOrange ScreenShot
BlueOcean ScreenShot
DeepBlue ScreenShot
MaceWindu ScreenShot
MojitoBlast ScreenShot
LovelyPink ScreenShot
Haze ScreenShot
Beach ScreenShot
Metalic ScreenShot
OrangeMango ScreenShot

If you liked it, stars are appreciated. If you want, feel free to fork or pull. =]

About

UIColor - Swift Extension. A delightful UIColor extension written in Swift for convenience purposes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published