/* | |
Distributed under The MIT License: | |
http://opensource.org/licenses/mit-license.php | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
The above copyright notice and this permission notice shall be | |
included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
*/ | |
CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 | |
CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white | |
CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black | |
UIColor *color = [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; |
This comment has been minimized.
This comment has been minimized.
Awesome, thanks. |
This comment has been minimized.
This comment has been minimized.
thank you so much for this. |
This comment has been minimized.
This comment has been minimized.
Thanks a lot! |
This comment has been minimized.
This comment has been minimized.
thanks you for your share |
This comment has been minimized.
This comment has been minimized.
thanks you :D |
This comment has been minimized.
This comment has been minimized.
thank you this is great for debugging. i set background color to random color when laying out many subviews |
This comment has been minimized.
This comment has been minimized.
Thank you! |
This comment has been minimized.
This comment has been minimized.
Thanks! its great for debugging. |
This comment has been minimized.
This comment has been minimized.
Quite a snippet there :) |
This comment has been minimized.
This comment has been minimized.
Thx a lot for ur share~ |
This comment has been minimized.
This comment has been minimized.
Great, thanks |
This comment has been minimized.
This comment has been minimized.
Great 1 ! Thx |
This comment has been minimized.
This comment has been minimized.
Thanks man :) |
This comment has been minimized.
This comment has been minimized.
Awesome :) |
This comment has been minimized.
This comment has been minimized.
Awesome! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
thanks!!! |
This comment has been minimized.
This comment has been minimized.
Thanx, this is a great solution! :) |
This comment has been minimized.
This comment has been minimized.
Cheers! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Boom, what I needed, thanks. |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
short and sweet. thanks for saving me some time! |
This comment has been minimized.
This comment has been minimized.
Great! |
This comment has been minimized.
This comment has been minimized.
Thank you! |
This comment has been minimized.
This comment has been minimized.
woo hoo :)))) Thank you very much :) |
This comment has been minimized.
This comment has been minimized.
ho hooo |
This comment has been minimized.
This comment has been minimized.
Thanks |
This comment has been minimized.
This comment has been minimized.
Thanks! This is great for debugging! |
This comment has been minimized.
This comment has been minimized.
thanks so much! |
This comment has been minimized.
This comment has been minimized.
Obrigado |
This comment has been minimized.
This comment has been minimized.
Thank you for the snippet @kylefox ... I think that on line #26 one should divide by 255 .. mod 256 yields a number between 0 and 255 otherwise you'll never get to 1.0. |
This comment has been minimized.
This comment has been minimized.
Mine was a bit more long but it work func changeBackgroundColor() {
|
This comment has been minimized.
This comment has been minimized.
Beauty! |
This comment has been minimized.
This comment has been minimized.
Thanks ! |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Thank you very much! |
This comment has been minimized.
This comment has been minimized.
Thanks |
This comment has been minimized.
This comment has been minimized.
Swift:
|
This comment has been minimized.
This comment has been minimized.
Thanks! |
This comment has been minimized.
This comment has been minimized.
Thx! |
This comment has been minimized.
This comment has been minimized.
Nice, thank you! |
This comment has been minimized.
This comment has been minimized.
Nice thanks |
This comment has been minimized.
This comment has been minimized.
Thanks a lot |
This comment has been minimized.
This comment has been minimized.
I have a color code like "15233421". How can I consider alpha value while using any of the solution? |
This comment has been minimized.
This comment has been minimized.
Thank you! |
This comment has been minimized.
This comment has been minimized.
Thank you so much for this share. It helps people like me who are new to iOS programming in ObjC |
This comment has been minimized.
This comment has been minimized.
Great...! |
This comment has been minimized.
Thanks!