Search code examples
ios13ios-darkmode

How to support dark mode for a UIlabelTextColor in iOS 13.x?


I Want the text color of UIlabel to be yellow on dark mode and black in normal mode.


Solution

  • You can define a Color Sets in your asset catalog with different variants for light and dark mode:

    Color Asset

    You can then use the color in Interface Builder or code with UIColor(named: "Color"). It will also adapt to appearance changes automatically.