Giter Site home page Giter Site logo

trendingtechnology / hexcolor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artman/hexcolor

0.0 0.0 0.0 44 KB

Utility that lets you define UIColors in Swift as they've meant to be defined: as HEX values

License: MIT License

Swift 85.96% Ruby 7.99% Objective-C 6.05%

hexcolor's Introduction

HexColor

Build Status CocoaPods Compatible Carthage Compatible License Platform Twitter

HexColor is a simple extension that lets you initialize UIColors the way they were meant to be initialized: With hex integer values.

Requirements

  • iOS 7.0 / watchOS 2.0 / tvOS 10.0
  • Xcode 9.0 (Swift 4.0)

Installation

To use HexColor with a project targeting iOS 7, simply copy HexColor.swift into your project.

CocoaPods

To integrate HexColor into your project add the following to your Podfile:

platform :ios, '8.0'
use_frameworks!

pod 'HxColor', '~> 4.0'

Carthage

To integrate Signals into your project using Carthage add the following to your Cartfile:

github "artman/HexColor" ~> 4.0

Quick start

myLabel.textColor = UIColor(0xFFFFFF) // Let there be white
myView.backgroundColor = UIColor(0x0f126f) // Deep blue

// Yay, finally you can stop to use this crap:
// UIColor.colorWithRed(0x0f/255.0, green: 0x12/255.0, blue: 0x65/255.0, 1.0)

Need colors with alpha? No worries:

myLabel.textColor = UIColor(0xFF0000).alpha(0.5) // Red with 50% opacity
myLabel.textColor = UIColor(0xFF0000, alpha: 0.5) // Another way to do this

You can also mix two colors together easily:

myLabel.textColor = UIColor(0x3377FF).mix(with: 0xFF2222, amount: 0.25)

Contribute

To contribute, just fork, branch & send a pull request. To get in touch, hit me up on Twitter @artman

License

HexColor is released under an MIT license. See the LICENSE file for more information

hexcolor's People

Contributors

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