Extending UIColor to Support Custom Styling
summary
Explains how UIColor extensions compute luminance from HSB/RGB components, implement the WCAG contrast formula, and automatically adjustColor brightness so a backend‑supplied or user‑picked color meets a min contrast ratio 7. Shows using UIColor.getHue(_:saturation:brightness:alpha:) and resolvedColor() to convert to CGColor, demonstrates examples (white vs black yields ~20:1, pink on black ~11:1, yellow on white 1:1), and outlines using iOS 13 dynamic colors and asset catalog color sets to handle dark mode.
AI-written summary · about
chapters (9)
- 0:00Introduction to color
- 1:31Understanding color spaces
- 4:40Deep dive into HSB
- 11:17Contrast and accessibility
- 13:00App themes and dark mode
- 14:43iOS 13 dynamic colors
- 19:25Custom color challenges
- 23:33Code solutions for contrast
- 29:02Conclusion
related talks
28mAdvanced Colors in iOS
21mDeep dive into the UIColor family
47mPixel perfect is dead, long live to adaptive and accessible iOS apps
30mThe Code Was The Easy Part: Introducing an iOS UI Library at a Corporate
28mA11y-oop Adding new Accessibility Features to not-so-new Apps
36mSwiftUI Everywhere
31mMaking the Most Out of Swift
31mTypography on iOS
