Search code examples
iosswiftuitextviewuicolor

How to set the background of a textView to a dark color and continue to see clearly the text selection?


I would like to set the colors for a textView to dark to avoid to stress the eyes when working on text.

If I set for example the field background to be black and the text to be white, the text color selection becomes a bit hard to see.

This is the code I'm using:

    mainTextField.backgroundColor = UIColor.black
    mainTextField.textColor = UIColor.white

Is there a way to have te selection of the text more visible?


Solution

  • I believe the text selection color is managed by the tintColor. You could set it to whatever you like by setting mainTextField.tintColor = UIColor.orange