All Projects β†’ zenangst β†’ Hue

zenangst / Hue

Licence: other
🎨 Hue is the all-in-one coloring utility that you'll ever need.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Hue

Dynamiccolor
Yet another extension to manipulate colors easily in Swift and SwiftUI
Stars: ✭ 2,677 (-19.03%)
Mutual labels:  hex, color, gradient
Coolhue
Coolest Gradient Hues and Swatches
Stars: ✭ 3,307 (+0.03%)
Mutual labels:  hue, color, gradient
colour
Validate colours.
Stars: ✭ 31 (-99.06%)
Mutual labels:  hex, color
Farge
🎈Tell the name of hex color
Stars: ✭ 23 (-99.3%)
Mutual labels:  hex, color
gradient-rs
A command line tool for playing with color gradients
Stars: ✭ 93 (-97.19%)
Mutual labels:  color, gradient
colr
Easy terminal colors, with chainable methods.
Stars: ✭ 32 (-99.03%)
Mutual labels:  color, gradient
react-color
🎨 Is a tiny color picker widget component for React apps.
Stars: ✭ 50 (-98.49%)
Mutual labels:  hex, color
Extract-Color-Palette-Api
Create gradient drawable by extracting prominent colors from image⚫βšͺ
Stars: ✭ 16 (-99.52%)
Mutual labels:  color, gradient
dehex
πŸŽ¨πŸ‘€ R package: learn to assess a colour hex code by eye
Stars: ✭ 29 (-99.12%)
Mutual labels:  hex, color
hex-to-css-filter
Easy way to generate colors from HEX to CSS Filters
Stars: ✭ 20 (-99.4%)
Mutual labels:  hex, color
color
A library of well-tested helper methods for working with colors.
Stars: ✭ 13 (-99.61%)
Mutual labels:  hex, color
utils.js
πŸ‘· πŸ”§ zero dependencies vanilla JavaScript utils.
Stars: ✭ 14 (-99.58%)
Mutual labels:  hex, color
ColorHelper
No description or website provided.
Stars: ✭ 34 (-98.97%)
Mutual labels:  hex, color
noire
🎨 Light/darken, mix, (de)saturate the colors in Golang with CMYK / RGB / HSV / HSL / Hex / HTML supported.
Stars: ✭ 38 (-98.85%)
Mutual labels:  hex, color
Xcodecolorsense2
πŸ‰ An Xcode source editor extension that shows hex color info
Stars: ✭ 281 (-91.5%)
Mutual labels:  hex, color
hcv-color
🌈 Color model HCV/HCG is an alternative to HSV and HSL, derived by Munsell color system, usable for Dark and Light themes... 🌈
Stars: ✭ 44 (-98.67%)
Mutual labels:  color, hue
Height-Based-Gradient-Color-Shaders-for-Unity
Height Based 2 color gradient shaders for Unity
Stars: ✭ 18 (-99.46%)
Mutual labels:  color, gradient
elm-color-extra
🎨 Additional color handling for Elm
Stars: ✭ 28 (-99.15%)
Mutual labels:  color, gradient
khroma
A collection of functions for manipulating CSS colors, inspired by SASS.
Stars: ✭ 28 (-99.15%)
Mutual labels:  hex, color
colorsys
🎨 Minimalistic color converter for RGB, HSV, HSL, CMYK, HEX and CSS strings
Stars: ✭ 53 (-98.4%)
Mutual labels:  hex, color

Hue

Hue is the all-in-one coloring utility that you'll ever need.

Version Carthage Compatible License Platform Swift

Usage

Hex

Hue IconYou can easily use hex colors with the init(hex:) convenience initializer on UIColor. It supports the following hex formats #ffffff, ffffff, #fff, fff

let white = UIColor(hex: "#ffffff")
let black = UIColor(hex: "#000000")
let red = UIColor(hex: "#ff0000")
let blue = UIColor(hex: "#0000ff")
let green = UIColor(hex: "#00ff00")
let yellow = UIColor(hex: "#ffff00")

Computed color properties

let white = UIColor(hex: "#ffffff")
let black = UIColor(hex: "#000000")

if white.isDarkColor {} // return false
if white.isBlackOrWhite {} // return true

Alpha

.alpha is a sugar for colorWithAlphaComponent, internally it does the exact same thing, think of it as a lipstick for your implementation.

let colorWithAlpha = myColor.alpha(0.75)

Gradients

You can easily create gradient layers using the gradient() method on arrays with UIColor. As an extra bonus, you can also add a transform closure if you want to modify the CAGradientLayer.

let gradient = [UIColor.blackColor(), UIColor.orangeColor()].gradient()

let secondGradient = [UIColor.blackColor(), UIColor.orangeColor()].gradient { gradient in
  gradient.locations = [0.25, 1.0]
  return gradient
}

Image colors

let image = UIImage(named: "My Image")
let (background, primary, secondary, detail) = image.colors()

Components

You can get red, green, blue, and alpha components from any UIColor by using the (red|green|blue|alpha)Component property.

let myColor = UIColor(hex: "#ffafc2")
let myColorBlueComponent = myColor.blueComponent
let myColorGreenComponent = myColor.greenComponent
let myColorRedComponent = myColor.redComponent
let myColorAlphaComponent = myColor.alphaComponent

Blending

let red = UIColor.redColor()
let green = UIColor.greenColor()
let yellow = red.addRGB(green)

let desaturatedBlue = UIColor(hex: "#aaaacc")
let saturatedBlue = desaturatedBlue.addHue(0.0, saturation: 1.0, brightness: 0.0, alpha: 0.0)

Supporting the project

If you want to support the development of this framework, you can do so by becoming a sponsor. ❀️

Examples

Hex Example screenshot

Hex

This super simple example that displays a bunch of color schemes in a Carousel view.

It uses hex to set the color for the schemes. It leverages from .isDarkColor to make the text color readable in all scenarios.

The demo also features Spots for rendering the Carousel view.

Example code:

let color = UIColor(hex: "#3b5998")
backgroundColor = color
label.textColor = color.isDark
  ? UIColor.whiteColor()
  : UIColor.darkGrayColor()

Gradients

Gradients Example screenshot

This examples shows how much fun you can have with combining CAGradientLayer with CABasicAnimation.

It uses .hex for getting the colors and .gradient() for transforming a collection of UIColor's into a CAGradientLayer.

The demo features Spots for rendering the list view and Fakery for generating random content strings.

Extract from the demo:

lazy var gradient: CAGradientLayer = [
  UIColor(hex: "#FD4340"),
  UIColor(hex: "#CE2BAE")
  ].gradient { gradient in
    gradient.speed = 0
    gradient.timeOffset = 0

    return gradient
  }

Installation

Hue is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Hue'

Hue is also available through Carthage. To install just write into your Cartfile:

github "hyperoslo/Hue"

To install Hue using Swift Package Manager with Xcode 11, just follow the instructions at https://developer.apple.com/documentation/swift_packages and import the platform specific library to the project:

import Hue

Author

Hyper made this with ❀️

Contribute

We would love you to contribute to Hue, check the CONTRIBUTING file for more info.

Credits

Credit goes out to Panic Inc who created ColorArt and @jathu for his work on UIImageColors which deeply inspired the functionality behind the image color analysis.

License

Hue is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].