Closed jimbojsb closed 9 years ago
The way it works, is it takes the float you pass in and multiplies the brightness of the color (from the Hue, Saturation, Brightness color formulation) by that value. So a .15 will result in a color that is 15% as bright as it used to be.
This might be confusing, and I'll look at making it what seems the most common-sense way of doing it.
Ah, I see. Darken by .85f gives me the result I was looking for. I think maybe just the method names are slightly confusing or even just updating the readme with with what you noted above is sufficient.
This is really confusing. I suggest we take inspiration from sass (http://sass-lang.com/documentation/Sass/Script/Functions.html#darken-instance_method)
darken(#ccc, 5%) makes #ccc 5% darker
Ok, it makes sense now. If you do [[UIColor plumColor] darken:0.05]
it makes a 5% darker color.
Works flawlessly @bennyguitar (currently using :head)
Hi,
I think there is either a bug with darken or I'm misunderstanding how to use it. Given an existing UIColor, if I lighten it by 0.15f, it lightens correctly (albeit slightly more than I might expect, but other color libraries, such as the one in less.js, behave identically). However, darkening by any amount results in a color that is not exactly black, but essentially black. What's odd is that lightening by a negative float gives exactly the results I'd expect.