A Swift extension providing convenience methods to create UIColor/NSColor instances from RGBA hex strings.
UIColor-Hex-Swift is a Swift library that adds convenience methods to Apple's color classes (UIColor and NSColor) for creating colors from RGBA hex strings. It solves the problem of cumbersome hex-to-color conversion in iOS, tvOS, and macOS development by providing a clean, native-feeling API.
iOS, tvOS, and macOS developers working in Swift who need to frequently use hex color codes in their user interfaces.
Developers choose this library for its simplicity, cross-platform support, and elimination of manual hex parsing code, making color handling more efficient and less error-prone.
Convenience methods for creating color using RGBA hex string.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Handles 3, 4, 6, and 8 character hex strings with or without alpha, as shown in the README examples like '#FFF' and '#FFCC00DD'.
Alpha is integrated directly into hex strings, eliminating the need for separate alpha parameters in color initialization.
Provides consistent methods for UIColor (iOS/tvOS) and NSColor (macOS), simplifying development across Apple ecosystems.
Includes a helper to convert Android-style ARGB hex strings to RGBA, useful for cross-platform design handoffs, as demonstrated with '#AFFF'.argb2rgba.
The library assumes valid hex inputs; invalid strings may lead to crashes or undefined behavior without clear error reporting in the API.
Focuses solely on hex parsing, lacking support for other color formats like HSL or advanced operations such as color interpolation.
Adding an external library for hex conversion might be unnecessary for small projects or those with minimal color needs, as Swift's native capabilities improve.