MacosTextField : Default cursor color to text color when not specified#559
MacosTextField : Default cursor color to text color when not specified#559Adrian-Samoticha merged 7 commits intomacosui:devfrom driftwoodstudio:MacosTextFieldCursorFix
Conversation
|
To be honest, shouldn’t the color match the current accent color, instead? I believe that’s how macOS does it (most of the time at least, it seems that Launchpad uses a white cursor, but that’s not really a window so it probably doesn’t count). |
|
If you're asking my opinion/preference, then I'd say No. The accent color is just another arbitrary default that may not be visible at all, or extremely low contrast, depending on what background color the text is on. At least the text color was chosen by the user to be visible on top of the background, so matching that choice by the user seems a more reliable default vs picking one of three arbitrary colors without regard for contrast/context (accent, black, white). I don't personally remember seeing accent color used as a cursor color, but there aren't many apps like mine with this sort of "the user gets to pick background and foreground-font colors while editing text" so it's not a common situation. |
|
Hmm, that’s an interesting use case. How are you supplying the widgets with the text color, though? Wouldn’t you be able to just provide the cursor color the same way (by just passing it into the |
|
I think there's a good argument for changing the default to accent color, as you've suggested. I think my situation is unusual, and there is a mechanism for addressing it via manual setting of cursor color if needed. I've changed my fork of the project to have the behavior I need, and I plan to stick with my fork rather than trying to re-adopt main fork due to the number of small issues I've hit where I'm kind of pushing the boundaries a bit and running into unusual combinations. |






MacosTextField has optional parameter .cursorColor that, if not specified, defaults to simple white or black (#fff, #000) depending on current ThemeMode.
If the MacosTextField does not always use default theme background color, the default cursor color may not be visible. This requires the dev to code it so if text color is non-default, the cursor color must also be overridden to non-default.
A more sensible fallback for "if not specified, use..." is to match the cursor color to the text. Just blanket forcing black or white is a poor choice when the text color is available to be examined instead.
Example: A writing app, where user can specify text color and background color. The user could be using any text color, on any background color, regardless of whether or no the app itself is in Dark or Light mode.
This change inserts "check text color" as an option, before giving up and simply choosing black or white with no regard for context.