<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A2 Apps &#187; UIColor</title>
	<atom:link href="http://a2apps.com.au/tag/uicolor/feed/" rel="self" type="application/rss+xml" />
	<link>http://a2apps.com.au</link>
	<description></description>
	<lastBuildDate>Sun, 10 Mar 2013 08:52:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Lighten or darken a UIColor</title>
		<link>http://a2apps.com.au/lighten-or-darken-a-uicolor/</link>
		<comments>http://a2apps.com.au/lighten-or-darken-a-uicolor/#comments</comments>
		<pubDate>Sat, 09 Feb 2013 02:55:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[iOS Snippets]]></category>
		<category><![CDATA[UIColor]]></category>

		<guid isPermaLink="false">http://a2apps.com.au/?p=20</guid>
		<description><![CDATA[]]></description>
				<content:encoded><![CDATA[<pre class="brush: objc; title: ; notranslate">
// [MYClass changeBrightness:someColor amount:1.1] returns a color that is 10% brighter than the original.
// 0.9 darkens by 10%. The percentage is relative to white, so 10% will lighten/darken the same amount
// regardless of how dark or light the color originally was. iOS5+

+ (UIColor*)changeBrightness:(UIColor*)color amount:(CGFloat)amount
{

    CGFloat hue, saturation, brightness, alpha;
    if ([color getHue:&amp;hue saturation:&amp;saturation brightness:&amp;brightness alpha:&amp;alpha]) {
        brightness += (amount-1.0);
        brightness = MAX(MIN(brightness, 1.0), 0.0);
        return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:alpha];
    }

    CGFloat white;
    if ([color getWhite:&amp;white alpha:&amp;alpha]) {
        white += (amount-1.0);
        white = MAX(MIN(white, 1.0), 0.0);
        return [UIColor colorWithWhite:white alpha:alpha];
    }

    return nil;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://a2apps.com.au/lighten-or-darken-a-uicolor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
