Cue
Cue

Reputation: 3092

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?

Upvotes: 4

Views: 3240

Answers (2)

user7886734
user7886734

Reputation:

UITextView text selection highlight color is determined by either the global or the view tint color.

You can set the color in Storyboard, by going to file inspector and setting the global tint color, or in attributes inspector of UITextView to apply it specifically for that view.

Attributes Inspector Tint Color

I also suggest that you set text color to Light Text Color.

Attributes Inspector Text Color

Upvotes: 2

Ryan Poolos
Ryan Poolos

Reputation: 18561

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

Upvotes: 2

Related Questions