Giter VIP home page Giter VIP logo

colorkit's People

Contributors

0xleif avatar boris-em avatar pepas-everly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colorkit's Issues

Bug on complimentaryColor() ?

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.

Color Histogram

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.

Color Names for Accessibility

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.

kMeansClustering algorithm: Fatal error: Unexpectedly found nil while unwrapping an Optional value

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.

dominantColors function crash for particular image

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:
Снимок экрана 2024-01-16 в 16 12 20

Please find the image here

Image -
IMG_6111

Could this issue be fixed? Looks like the safe check for dictionary should be added. Thanks in advance!

Localize Color Names

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.

iOS 17 issues getting dominantColors

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?

macOS support

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?

Cocoapods release

For those who can't use swift package manager it would be really handy if this great library will be available from cocoapods.

Color unknown type

When importing ColorKit SwiftUI can’t find Color anymore …
Will provide detailed error logs soon ..

I can't get dominant colors from pictures taken with iPhone

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.

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.