Git Product home page Git Product logo

color's People

Contributors

chenyongwei avatar dblock avatar dongle avatar gurgeous avatar orta avatar pixelslip avatar readmecritic avatar sbandol avatar shuoli84 avatar thisandagain avatar yeahphil 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

color's Issues

Add support for Winsor-Newton colors

There're several Winsor-Newton charts:

http://www.winsornewton.com/resource-centre/colour-charts/

Artists Oil Colour
Winton Oil Colour
Griffin Alkyd Fast Drying Oil Colour
Artisan Water Mixable Oil Colour Artists' Oilbar
Artists Acrylic Colour
Galeria Acrylic Colour
Artists Water Colour
Cotman Water Colour
Designers Gouache
Drawing Inks
Calligraphy Inks

The colors have other information, such as Colour name, Colour code, Permanence Rating, Opacity and the ASTM rating.

Warning when compiling

/Users/erick/iOSProjects/xxx/Pods/EDColor/EDColor/UIColor+Hex.m:67:25: Implicit conversion loses integer precision: 'unsigned long long' to 'int'

Force type cast to int looks like solve this problem.

// xx
            r = g = b = (int) value;
            a = 255;
            break;

Add UIColour

This might be a bit crazy, but how about adding a UIColour class that delegates all calls to UIColor?

Replacing OCUnit

Any interest in replacing OCUnit with Specta / Expecta? It would be an upgrade with better syntax IMO.

colorWithHexString is slow

It's not a huge deal, but colorWithHexString is slow. I was considering switch to EDColor and I benchmarked my existing fromHex and colorWithHexString. Here are the results on an iPad 2:

    const int ITER = 10000;
    double tm = CACurrentMediaTime();
    for (int i = 0; i < ITER; ++i) {
        [UIColor fromHex:@"#123456"];
    }
    NSLog(@"fromHex %.3f", CACurrentMediaTime() - tm);
    tm = CACurrentMediaTime();
    for (int i = 0; i < ITER; ++i) {
        [UIColor colorWithHexString:@"#123456"];
    }
    NSLog(@"colorWithHexString %.3f", CACurrentMediaTime() - tm);
fromHex 0.070
colorWithHexString 2.170

This makes me a bit nervous about using colorWithHexString in paint-intensive code, at least not without some caching. Here's the fromHex that I'm using:

+ (UIColor *)fromHex:(NSString *)hex
{
    const char *s = [hex cStringUsingEncoding:NSASCIIStringEncoding];
    if (*s == '#') {
        ++s;
    }
    unsigned long long value = strtoll(s, nil, 16);
    int r, g, b, a;
    switch (strlen(s)) {
        case 3:
            // RGB
            r = ((value & 0xf00) >> 8);
            g = ((value & 0x0f0) >> 4);
            b = ((value & 0x00f) >> 0);
            r = r * 16 + r;
            g = g * 16 + g;
            b = b * 16 + b;
            a = 255;
            break;
        case 6:
            // RRGGBB
            r = (value & 0xff0000) >> 16;
            g = (value & 0x00ff00) >>  8;
            b = (value & 0x0000ff) >>  0;
            a = 255;
            break;
        default:
            // RRGGBBAA
            r = (value & 0xff000000) >> 24;
            g = (value & 0x00ff0000) >> 16;
            b = (value & 0x0000ff00) >>  8;
            a = (value & 0x000000ff) >>  0;
            break;
    }
    return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a/255.0f];
}

Thanks for all your hard work!

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.