|Title:||Use platform placeholder text colors as defaults|
|Submitter:||chrstphrchvz||Created on:||2020-07-14 10:23:30|
|Subsystem:||07. [entry]||Assigned To:||fvogel|
|Status:||Closed||Last Modified:||2020-08-24 13:06:38|
|Closed on:||2020-08-24 13:06:38|
[https://core.tcl-lang.org/tips/doc/trunk/tip/496.md|TIP #496] ([11fcd2c708]) added support for placeholder text in Entry widgets. The default <code>-placeholderforeground</code> is currently specified as #b3b3b3 (gray70) for all platforms. However, some platforms already provide a specific system color that should be used for this purpose. On macOS 10.10 and later, this is <a href="https://developer.apple.com/documentation/appkit/nscolor/2998829-placeholdertextcolor?language=objc"><code>placeholderTextColor</code></a>. There may be a similar system color on Windows, however I'm not sure there is a more specific one to use than <a href="https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsyscolor#COLOR_GRAYTEXT"><code>COLOR_GRAYTEXT</code></a>.
fvogel added on 2020-08-24 13:06:38:
Merged into trunk.
fvogel added on 2020-08-15 07:45:59: (text/x-fossil-wiki)
A few further commits later (to make use of the updated mac color files - thanks Marc!, and to update the documentation), I believe this [https://core.tcl-lang.org/tk/timeline?r=rfe-de0c219db2|rfe branch] is ready to be merged into trunk. I will proceed soon, unless new comments gets submitted.
fvogel added on 2020-07-14 21:54:07:
Now done (both the revert and the ttk widgets adaptation). Please see the rfe branch. Comments? Thanks!
fvogel added on 2020-07-14 21:13:49: (text/x-fossil-wiki)
Indeed. I have reworked this, see the [https://core.tcl-lang.org/tk/timeline?r=rfe-de0c219db2|rfe branch]. I have updated the documentation as well. I tried to use the same color name on Windows as on macOS. This led to name this color <code>systemPlaceholderTextColor</code> on both platforms, which is slightly inconsistent with how colors are named on Windows (it would rather have been <code>systemPlaceholderText</code> on Win). Not fully sure what is the right thing to do here, I will probably revert to <code>systemPlaceholderText</code> on Win after all. There is still the ttk::entry widget to deal with.
chrstphrchvz added on 2020-07-14 17:11:57: (text/x-fossil-wiki)
Sorry for the confusion: I had referred to the system colors as named by platforms' APIs; they need to first be defined in tkWinColor.c, tkMacOSXColor.c, etc., before they're ready to be used in tkWinDefault.h, tkMacOSXDefault.h, etc. So on Aqua, the color would likely be named <code>"systemPlaceholderTextColor"</code>. (This could be safely done for 8.6 though it would be unused.) tkMacOSXColor.c is also where compatibility with older systems would be handled: on 10.9 and earlier there is <code>NSColor grayColor</code>. Or possibly there is another close-enough system color (one that Tk might already be using). I also do not currently know if there is a better alternative for <b>X11</b>.
fvogel added on 2020-07-14 16:34:10: (text/x-fossil-wiki)
Thanks for making this observation. I have committed the change you suggest in [5fc386f85b]. A few remarks/questions: * I could test on Windows: COLOR_GRAYTEXT is very close (if not identical) to the previous default #b3b3b3 (gray70). Fine. * I could <i>not</i> test on the mac because my remote access to a mac is currently broken. Can you try perhaps? * On the mac #b3b3b3 is still used as default for macOS versions before 10.10. Are you aware of a better choice? * On Linux I made no change and kept #b3b3b3 since I could not find anything relevant on the subject on the internet.