-3

Image of wrong highlight colour used

I am using the new AttributedString in Swift 26 with a TextEditor in dark mode to track selections for a qualitative data analysis tool.

ISSUE: In dark mode, the highlight colour inherited from system settings uses the colour from light mode instead of the contrast-appropriate darker scheme. This makes it difficult to read the selected text.

ANALYSIS:

  • Using a normal String in the TextEditor works correctly.

  • Selections using AttributedString in TextField or Text also work correctly.

My conclusion is therefore that the new TextEditor is the source of the issue.

FIXES EXPLORED:

  • Applying .preferredColorScheme(.dark) at various levels in the view hierarchy.

  • Setting .background to various darker colours at various levels in the hierarchy.

  • Changing .tint() to anything else (actually does not seem to affect anything).

I have not explored whether this issue persists on other OSs, I have only tried MacOS.

Any thoughts on what is causing the issue - and optimistically - any fixes would be much appreciated!

ninadepina
1,0519 silver badges17 bronze badges
asked Nov 13 at 12:44

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.