CyaneaOctopus is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CyaneaOctopus'
CyaneaOctopus.clr
This is a color pallet library for Interface Builder (and other mac apps that use the color library.
To install, from Finder > Go, hold Option
and click Library. Copy the .clr file to /Library/Colors
CyaneaOctopus.aco This is a color pallet swatch for Adobe products. You can load this by clicking the Load Swatches... button in the Swatches panel.
CyaneaOctopus is a lightweight, yet powerful, color framework for iOS written in pure Swift. It is based upon Chameleon framework by Vicc Alexander. The Chameleon framework appears to be abandoned, so it was rebuilt here as CyaneaOctopus (another animal that can change its colors).
With CyaneaOctopus, you can easily stop tinkering with RGB values, wasting hours figuring out the right color combinations to use in your app, and worrying about whether your text will be readable on the various background colors of your app.
- 24 Flat Colors in 2 Shades
- Gradient Colors
- Generate Colors from Images
- Lighten or Darken Any Color
- Hex Color Support
- Global App Theming
- Swift 4.2
CyaneaOctopus features over 24 hand-picked colors that come in both light and dark shades.
CyaneaOctopus allows you to seamlessly extract non-flat or flat color schemes from images without hassle. You can also generate the average color from an image with ease. You can now mold the UI colors of a profile, or product based on an image!
- Swift
- Requires a minimum of iOS 9.0 for Swift.
- Requires Xcode 6.3 for use in any iOS Project
CyaneaOctopus is released and distributed under the terms and conditions of the MIT license.
If you run into problems, please open up an issue. We also actively welcome pull requests. By contributing to CyaneaOctopus you agree that your contributions will be licensed under its MIT license.
All methods, properties, and types available in CyaneaOctopus are documented below.
CyaneaOctopus is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CyaneaOctopus'
If you rather install this framework manually, just drag and drop the CyaneaOctopus folder into your project, and make sure you check the following boxes.
To use the features in CyaneaOctopus, include the following import:
import CyaneaOctopus
view.backgroundColor = UIColor.flatGreenDark
view.backgroundColor = FlatGreenDark()
Setting the color for a light shade is the same, except without adding the Dark suffix. (By default, all colors without a Dark suffix are light shades). For example:
view.backgroundColor = UIColor.flatGreen
view.backgroundColor = FlatGreen()
Gradient colors can be created by passing a view to color, an array of UIColors, and a direction for the gradient.
let colors : [UIColor] = [.flatBlueColor(),.flatRedColor(),.flatGreenColor()]
UIColor.gradientColor(view: view, colors: colors, direction: .leftToRight)
- topToBottom
- leftToRight
- bottomToTop
- rightToLeft
- topLeftToBottomRight
- topRightToBottomLeft
- bottomLeftToTopRight
- bottomRightToTopLeft
There are four ways to generate a random flat color. If you have no preference as to whether you want a light shade or a dark shade, you can do the following:
view.backgroundColor = UIColor.randomFlat
view.backgroundColor = RandomFlatColor()
UIShadeStyles:
UIShadeStyleLight
(UIShadeStyle.Light
in Swift)UIShadeStyleDark
(UIShadeStyle.Dark
in Swift)
One of the most requested features, hex colors, is now available. You can simply provide a hex string with or without a # sign:
UIColor(hexString:string)
HexColor(hexString)
Retrieving the hexValue
of a UIColor is just as easy.
FlatGreen.hexValue //Returns @"2ecc71"
Sometimes all you need is a color a shade lighter or a shade darker. Well for those rare, but crucial moments, CyaneaOctopus's got you covered. You can now lighten any color the following way:
color.lightenByPercentage(percentage: CGFloat)
You can also generate a darker version of a color:
color.darkenByPercentage(percentage: CGFloat)
Cyanea Octopus supports color overlay and tiniting of UIImages.
let dice = UIImage(named: "test")?.tint(.red)
All grey-scale colors are tinted with the desired color.
let dice = UIImage(named: "test")?.overlayColor(.yellow)
The alpha channel is fully colored.
CyaneaOctopus now supports the extraction of colors from images. You can either generate both flat and non-flat color schemes from an image, or easily extract the average color.
To generate a color scheme simply do the following:
ColorsFromImage(image, isFlatScheme)
To extract the average color from an image, you can also do:
UIColor(averageColorFromImage: UIImage)
CyaneaOctopus was developed by Adam McElhaney (@windmarble) in 2018 using Swift 4.2. Currently, it is being maintained by @adammcelhaney.
- Add Flattening Of Colors
- Add Colors with Shades
- Add Complementary Colors
- Add "night mode" functionally to swap out colors to a different theme on the fly.