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
Stringin theTextEditorworks correctly.Selections using
AttributedStringinTextFieldorTextalso 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
.backgroundto 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!