thisandagain / color Goto Github PK
View Code? Open in Web Editor NEWA collection of categories and utilities that extend UIColor
License: MIT License
A collection of categories and utilities that extend UIColor
License: MIT License
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!
Dan Colen creates mixed-media, sculptural, and painted works that locate interest and magic within the seemingly ordinary and undervalued.
A recent post includes his color palette, that has some interesting names like "Emerald City" or "Swamp Thing". Check out https://artsy.net/post/marinakcashdan-bird-sh-star-t-bubble-gum-and-crack-pipes.
I think the Github repo should be called EDColor to match.
https://github.com/VAlexander/Chameleon has some good concepts, notably structured color schemes and some flatifying methods.
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.
UIColor+HSB.h is missing a newline at the end of the file. Creates an annoying warning (obviously, no functional problems).
Kinda not worth forking to PR this one... ;)
This is brilliant: http://www.checkman.io/please/
It could be interesting to document color resources in README, and give some philosophy around this project.
For example, http://www.thisiscolossal.com/2014/05/color-book/ is fascinating.
Currently I'm short on time, but I'll add my X11 colors (https://github.com/steffex/x11Colors) library to this one!
[UIColor colorWithHexString:@"#CCC" andAlpha:0.5f];
Please add this helpful feature.
This might be a bit crazy, but how about adding a UIColour class that delegates all calls to UIColor?
http://www.winsornewton.com/products/water-colours/artists-water-colour/colour-chart/
Note the British spelling of colour, not sure what to do about that.
/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;
Receiving a UIColor+HSB.h:15:5: No newline at end of file. The compiler flags for no newline at end of file [-Werror,-Wnewline-eof].
Using Cocoapods with Using EDColor (1.0.0).
https://en.wikipedia.org/wiki/HWB_color_model
HWB is a cylindrical-coordinate representation of points in an RGB color model, similar to HSL and HSV.
We're trying to use the darken:
method, but an updated version for this library has not been created since they method was written.
Awesome library btw
Any interest in replacing OCUnit with Specta / Expecta? It would be an upgrade with better syntax IMO.
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.