EdColor is a powerful color utility library for iOS developers. It provides a wide range of features for working with colors, including color conversions, blending, tinting, shading, and more.
Installation
To use EdColor in your iOS project, you can add it as a dependency in your Podfile
:
pod 'EdColor', '~> 1.0'
Then, run the following command:
pod install
Usage
Color Conversion
EdColor provides methods for converting colors between different color spaces, such as:
- RGB to HEX:
- HEX to RGB:
- RGB to HSB:
- HSB to RGB:
NSString *hexColor = [EDColor hexFromCGColor:[UIColor redColor].CGColor];
UIColor *rgbColor = [EDColor colorWithHexString:@"#FF0000"];
CGFloat h, s, b;
[EDColor getHue:&h saturation:&a brightness:&b fromColor:[UIColor redColor]];
UIColor *rgbColor = [EDColor colorWithHue:0.0 saturation:1.0 brightness:1.0 alpha:1.0];
Color Blending
EdColor allows you to blend two colors together, either by specifying a blend mode or a predefined blend style.
- Blend Mode:
- Predefined Blend Style:
UIColor *blendedColor = [EDColor blendColor:[UIColor redColor] withColor:[UIColor whiteColor] mode:EDColorBlendModeMultiply];
UIColor *blendedColor = [EDColor blendColor:[UIColor redColor] withColor:[UIColor whiteColor] style:EDColorBlendStyleOverlay];
Color Tinting and Shading
EdColor allows you to apply tints or shades on a base color by specifying the tint or shade factor.
- Tinting:
- Shading:
UIColor *tintedColor = [EDColor tintColor:[UIColor redColor] factor:0.5];
UIColor *shadedColor = [EDColor shadeColor:[UIColor redColor] factor:0.5];
Reference
You can find more detailed information about EdColor’s methods and classes in the official documentation. Feel free to explore the various features and functionalities provided by the library.
Conclusion
EdColor simplifies color manipulation in iOS development with its comprehensive set of features. Whether you need to convert color spaces, blend colors, or apply tints and shades, EdColor has got you covered. Take advantage of this powerful library to enhance your app’s color schemes and visual aesthetics.