I do not see any way to change the text color for a UIColorPickerViewController
. Otherwise it's perfect for my needs and would prefer to use it versus making my own picker. I have a light and dark theme for my app and is important that I match the theme.
I've tried the usual hacks like:
myPickerView.setValue(UIColor.red, forKey: "textColor")
But it's not key textColor
compliant and crashes.
Changing the tint color changes the eyedropper icon but no text:
myPickerView.view.tintColor = .cyan
The toolbarItems
property is nil.
I tried overriding preferredStatusBarStyle
:
class MyUIColorPickerViewController:UIColorPickerViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .darkContent
}
}
It has a navigationItem
property, but all of its' properties are nil and navigationController
is nil.
I tried looking at all the subviews of its subviews, but nothing. Seems like there must be a way. Sad Apple doesn't provide us very basic control over its appearance.
If it is just to match your own custom dark and light themes, you can set overrideUserInterfaceStyle
on the color picker view controller to the matching .light
/.dark
value.
// when in your own dark mode
myPickerView.overrideUserInterfaceStyle = .dark