ImagePalette - Swift/iOS port of Android's Palette

Related tags

Color ImagePalette
Overview

ImagePalette

Swift/iOS port of Android's Palette https://developer.android.com/reference/android/support/v7/graphics/Palette.html

Basic Usage

Palette.generateWith(configuration: PaletteConfiguration(image: image)) {
	if let color = $0.darkMutedSwatch?.color {
		self.backgroundColor = color
	}

	if let color = $0.lightVibrantSwatch?.color {
		self.textLabel.textColor = color
	}
}

License

Apache License 2.0 (inherited from the Andorid project) -- see the LICENSE file for more information.

You might also like...
iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion. You can use this app for learning purpose. You can use this app as a templet of any event related app.
iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion. You can use this app for learning purpose. You can use this app as a templet of any event related app.

technex-ios iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion for some reasons. You can use this app for learning purpo

iTunes 11 Style Color Art Detection for iOS
iTunes 11 Style Color Art Detection for iOS

iTunes 11 Style Color Art Detection for iOS. Original implementation from Fred Leitz Port of ColorArt code from OS X to iOS. Usage #include ColorArt/

ChromaColorPicker - An intuitive HSB color picker built in Swift
ChromaColorPicker - An intuitive HSB color picker built in Swift

An intuitive HSB color picker built in Swift. Supports multiple selection handles and is customizable to your needs.

Yet another extension to manipulate colors easily in Swift and SwiftUI
Yet another extension to manipulate colors easily in Swift and SwiftUI

DynamicColor provides powerful methods to manipulate colors in an easy way in Swift and SwiftUI. Requirements • Usage • Installation • Contribution •

Gradients  🌔 A curated collection of 180 splendid gradients made in swift
Gradients 🌔 A curated collection of 180 splendid gradients made in swift

Gradients 🌔 A curated collection of 180 splendid gradients made in swift 180 splendid Gradients inspired by itmeo/webgradients View all the gradients

PrettyColors is a Swift library for styling and coloring text in the Terminal.

PrettyColors is a Swift library for styling and coloring text in the Terminal. The library outputs ANSI escape codes and conforms to ECMA Standard 48.

HEX color handling as an extension for UIColor. Written in Swift.

SwiftHEXColors HEX color handling as an extension for UIColor. Written in Swift.

Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more).
Color framework for Swift & Objective-C (Gradient colors, hexcode support, colors from images & more).

Swift 3 To use the Swift 3 version, add this to your Podfile (until 2.2 or higher is released): pod 'ChameleonFramework/Swift', :git = 'https://githu

An attractive color generator for Swift. Ported from randomColor.js.
An attractive color generator for Swift. Ported from randomColor.js.

Random Color Swift Inspired by David Merfield's randomColor.js. It is a ported version to Swift. You can use the library to generate attractive random

Comments
  • Update to Swift 3

    Update to Swift 3

    It would be great if this could be converted to Swift 3. I am not an expert on Swift unfortunately, so some conversion choices are a bit hard to make myself.

    opened by peterdk 4
  • Bug in weightedMean function in DefaultPaletteGenerator

    Bug in weightedMean function in DefaultPaletteGenerator

    There appears to be a bug in DefaultPaletteGenerator.swift, line 152, func weightedMean: defer { i += 1 }

    The Android version of ImagePalette increments by 2 because the input variable "values" is used with alternating function and weight. With the way it is in this Swift port right now, I don't think the result of weightedAverage is any good.

    In my particular use case, there is a crash at line 154: let weight = values[i + 1] An exception is raised while trying to access an element outside the bounds of the array.

    My use case involves initializing a PaletteConfiguration with an image and setting resizeMaxDimension == 1 before extracting swatch 0 to get an average color for the whole image to use in decision logic. Admittedly there are better ways of doing this than pulling in the ImagePalette library, but we will have additional uses for its functionality down the road.

    opened by dbrooks-tango 0
  • Update Image Palette to 4.2 and cache color by NSCache

    Update Image Palette to 4.2 and cache color by NSCache

    • I Update swift 3.0 to swift 4.2 and I update all the warnings about swift4.2.
    • I use the NSCache to save color by path of image. that is not generate color again.
    opened by apinun-wong 0
  • Dominant Swatch is missing in iOS library

    Dominant Swatch is missing in iOS library

    Dominant swatch is the most important part to extract the colors. Any possible support for this ?

    Android version: /** * Returns the dominant swatch from the palette. * *

    The dominant swatch is defined as the swatch with the greatest population (frequency) * within the palette.

    */ @Nullable public Swatch getDominantSwatch() { return mDominantSwatch; }

    opened by Ankish 0
Owner
Shaun Harrison
built @grindjs + atmosapp.com && cofounder of @enormego && eng at @snapchat
Shaun Harrison
Google Material Color Palette in Swift

Google Material Color in Swift Defined Google Material Color value ready to use in Swift refer to Google Material Design in Style/Color section ###How

Todsaporn Banjerdkit 48 Oct 30, 2019
SwiftOpenColor - Swift port of OpenColor

Using Swift Package Manager, add it as a Swift Package in Xcode 11.0 or later

sam woolf 6 Apr 12, 2022
Conical (angular) gradient for iOS written in Swift

AEConicalGradient Conical (angular) gradient in Swift I hope that somebody will find this useful. And nice. Usage AEConicalGradient is a minion which

Marko Tadić 82 Dec 27, 2022
An Adobe .ase (Adobe Swatch Exchange File), .aco (Photoshop swatch file) reader/writer package for Swift (macOS, iOS, tvOS, macCatalyst)

ColorPaletteCodable A palette reader/editor/writer package for iOS, macOS, watchOS and tvOS, supporting the following formats Adobe Swatch Exchange (.

Darren Ford 11 Nov 29, 2022
SheetyColors is an action sheet styled color picker for iOS

?? Based on UIAlertController: The SheetyColors API is based on UIKit's UIAlertController. Simply add buttons to it as you would for any other Action Sheet by defining UIAlertAction instances. Therefore, it nicely integrates with the look & feel of all other native system dialogs. However, you can also chose to use the color picker it self without an action sheet.

Christoph Wendt 102 Nov 10, 2022
A tool to calculate the color ratio of UIImage in iOS.

UIImageColorRatio A tool to calculate the color ratio of UIImage in iOS. How to use UIImageColorRatio Get the color ratio of UIImage. let image = ...

Yanni Wang 王氩 34 Jan 1, 2023
Colour blindness simulation and testing for iOS

Color Deficiency Snapshot Tests This package makes it easier for you to understand the implications of your app's design on users with various types o

James Sherlock 69 Sep 29, 2022
A beautiful set of predefined colors and a set of color methods to make your iOS/OSX development life easier.

Installation Drag the included Colours.h and Colours.m files into your project. They are located in the top-level directory. You can see a demo of how

Ben Gordon 3.1k Dec 28, 2022
An unintrusive & light-weight iOS app-theming library with support for animated theme switching.

Gestalt Gestalt is an unintrusive and light-weight framework for application theming with support for animated theme switching. Usage Let's say you wa

Vincent Esche 327 Nov 8, 2022
A powerful and easy to use live mesh gradient renderer for iOS.

MeshKit A powerful and easy to use live mesh gradient renderer for iOS. This project wouldn't be possible without the awesome work from Moving Parts a

Ethan Lipnik 51 Jan 1, 2023