boris-em / colorkit Goto Github PK
View Code? Open in Web Editor NEWAdvanced color manipulation for iOS.
License: MIT License
Advanced color manipulation for iOS.
License: MIT License
First of all, thanks for this great package! I would love to use it on macOS as well but noticed that it only supports iOS. Are there any plans to make this work for macOS (and/or tvOS) too?
I think this might be a bug? Here's my code.
let greenComp:UIColor = UIColor.green.complementaryColor //works let greenCompComp:UIColor = greenComp.complimentaryColor //error: value of type 'UIColor' has no member 'complimentaryColor'
I know that UIColor does have member complimentaryColor cause it just used it in line 1. Not sure if I did something wrong.
Calculating things like Analogous Color or Tetradic Color could be useful.
See https://www.sessions.edu/color-calculator/ for more.
I'm using this function on each image of a video feed, and after a few seconds/tens of second, my program stops with this error, EXC_BAD_ACCESS (code=1, address=0xd833deece4d0). I assume it comes from this function and precisely kMeansClustering, because I don't encounter this issue using .iterative algorithm
Hey!
Found a bug for the following function:
extension UIImage {
func getDominantColors(with minCount: Int = 0) -> [UIColor]? {
var resultColors: [UIColor]?
// Try With PNG Data
if let pngData = pngData(),
let pngImage = UIImage(data: pngData),
let colors = try? pngImage.dominantColors(with: .best, algorithm: .iterative) {
if colors.count >= minCount {
return colors
} else {
resultColors = colors
}
}
// Try With JPEG Data
if let jpegData = jpegData(compressionQuality: 1),
let jpegImage = UIImage(data: jpegData),
let colors = try? jpegImage.dominantColors(with: .best, algorithm: .iterative) {
if colors.count >= minCount {
return colors
} else {
resultColors = colors
}
}
// Try With Original Image
if let colors = try? dominantColors(with: .best, algorithm: .iterative) {
if colors.count >= minCount {
return colors
} else {
resultColors = colors
}
}
if let colors = try? dominantColors() {
if colors.count >= minCount {
return colors
} else {
resultColors = colors
}
}
return resultColors
}
}
When the following image is added as input parameter, crash inside ColorKit happened:
I'm testing my app with the iOS 17 public beta and I get totally unexpected dominant colors, whereas on my device with iOS 16 I still see them fine.
It could be a bug of the beta but it could also be that there's something fundamentally different in UIImage now. Can you guys check that?
Hey, first of all thanks for this amazing, impressive library.
I'd like to report that when using .kMeansClustering
algorithm, I often get a crash from unwrapping nil value.
It happens at line 112 in file ColorPalette.swift
The image I'm feeding to the algorithm is a transparent PNG (an asset file) so that's probably the cause of it. I know it doesn't make sense to pull colors from such image but the code should fail gracefully in such cases.
Via #10, we introduced a new function called name()
that gives the English name of a UIColor
instance.
Localizing those names makes sense as a next step.
When importing ColorKit SwiftUI can’t find Color anymore …
Will provide detailed error logs soon ..
Generating color histograms out of images.
Here is some good resource from OpenCV as to what type of histogram we could generate as well as how to represent them.
Properties .red, .green, .blue is in conflict with standard static properties .red, .green, .blue when I add project as the folde
For those who can't use swift package manager it would be really handy if this great library will be available from cocoapods.
A useful feature for accessibility is to be able to attach a readable color name to UIColor
instances.
For example UIColor.red
or UIColor(red: 1.0, green: 0.0, blue: 0.0)
should read something like "red".
A trivial implementation of this could be to work with a predefined color palette and just compare it to the colors using the existing deltaE.
Hi!
CIEDE2000 Shows on the comparison options bug isn't implemented.
Is there a reason it wasn't implemented? How hard would it be?
Hello,
first of all I wanted to say thank you for this awesome kit.
I'm using ColorKit to generate a color palette of pictures that I manually add from my photo library. Everything work good but I only have problems with pictures of my library that were not taken with my iPhone.
If I want to get the colors of pictures taken with my iPhone or a screenshot which was taken with my iPhone the function .dominantColors does not work.
Is it a format thing? or maybe I missed something.
If I send the picture per WhatsApp and then I download the same picture I can get the colors but not from the original. Photos taken with an external camera and then imported to the iPhone have also no problem at all. Only Iphone photos.
I appreciate your help, thank you very much!
Pablo.
UPDATE
I think that the problem is that ColorKit can't use .dominantColors() with pictures taken with the iPhone because they are HEIF/HEIC files. I still can't solve the problem but I'm trying to convert the image to JPEG. I don't know if that is useful because I thought UIImage also supports HEIF format.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.