diff options
author | fvogel <fvogelnew1@free.fr> | 2020-08-24 13:04:46 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2020-08-24 13:04:46 (GMT) |
commit | 4c474c358fa8484bfbe53f338c280d33ad8fecab (patch) | |
tree | 0a36740965b61e3214c164667837b741eaa9da3e | |
parent | 0925898c0b0d5fde21ba8e414525bf5dd7f70757 (diff) | |
parent | 914c191b92ad40942ff18e343bddb6b6baca72d5 (diff) | |
download | tk-4c474c358fa8484bfbe53f338c280d33ad8fecab.zip tk-4c474c358fa8484bfbe53f338c280d33ad8fecab.tar.gz tk-4c474c358fa8484bfbe53f338c280d33ad8fecab.tar.bz2 |
Fix [de0c219db2]: Use platform placeholder text colors as defaults. Note: Resolved the 6 conflicts in macosx/tkMacOSXColor.c by keeping the trunk version.
-rw-r--r-- | doc/colors.n | 19 | ||||
-rw-r--r-- | doc/options.n | 3 | ||||
-rw-r--r-- | doc/ttk_combobox.n | 4 | ||||
-rw-r--r-- | doc/ttk_entry.n | 4 | ||||
-rw-r--r-- | doc/ttk_spinbox.n | 4 | ||||
-rw-r--r-- | doc/ttk_widget.n | 9 | ||||
-rw-r--r-- | macosx/README | 32 | ||||
-rw-r--r-- | macosx/tkMacOSXDefault.h | 2 | ||||
-rw-r--r-- | tests/ttk/entry.test | 12 | ||||
-rw-r--r-- | unix/tkUnixDefault.h | 4 | ||||
-rw-r--r-- | win/tkWinColor.c | 1 | ||||
-rw-r--r-- | win/tkWinDefault.h | 2 |
12 files changed, 61 insertions, 35 deletions
diff --git a/doc/colors.n b/doc/colors.n index 3747ee8..9d8d653 100644 --- a/doc/colors.n +++ b/doc/colors.n @@ -919,19 +919,20 @@ On Windows, the following additional system colors are available .RS .DS .ta 6c -system3dDarkShadow systemHighlight -system3dLight systemHighlightText -systemActiveBorder systemInactiveBorder -systemActiveCaption systemInactiveCaption -systemAppWorkspace systemInactiveCaptionText -systemBackground systemInfoBackground -systemButtonFace systemInfoText -systemButtonHighlight systemMenu -systemButtonShadow systemMenuText +system3dDarkShadow systemHighlightText +system3dLight systemInactiveBorder +systemActiveBorder systemInactiveCaption +systemActiveCaption systemInactiveCaptionText +systemAppWorkspace systemInfoBackground +systemBackground systemInfoText +systemButtonFace systemMenu +systemButtonHighlight systemMenuText +systemButtonShadow systemPlaceholderText systemButtonText systemScrollbar systemCaptionText systemWindow systemDisabledText systemWindowFrame systemGrayText systemWindowText +systemHighlight .DE .RE .SH "SEE ALSO" diff --git a/doc/options.n b/doc/options.n index 56e65dd..b1af80d 100644 --- a/doc/options.n +++ b/doc/options.n @@ -230,8 +230,7 @@ that is when the widget is empty. The placeholder text is displayed using the values of the \fB\-font\fR and \fB\-justify\fR options. .OP \-placeholderforeground placeholderForeground PlaceholderForeground Specifies the foreground color to use when the placeholder text is -displayed. If this option is the empty string, the default color gray70 -is used. +displayed. The default color is platform-specific. .OP \-relief relief Relief Specifies the 3-D effect desired for the widget. Acceptable values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR, diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n index 3ec3e77..3ece362 100644 --- a/doc/ttk_combobox.n +++ b/doc/ttk_combobox.n @@ -19,7 +19,7 @@ the user may select the value of the text field from among the values in the list. .SO ttk_widget \-class \-cursor \-takefocus -\-style \-placeholder +\-style \-placeholder \-placeholderforeground .SE .\" ALSO: Other entry widget options .SH "WIDGET-SPECIFIC OPTIONS" @@ -148,6 +148,8 @@ Can only be changed when using non-native and non-graphical themes. .br \fB\-padding\fP \fIpadding\fP .br +\fB\-placeholderforeground\fP \fIcolor\fP +.br \fB\-postoffset\fP \fIpadding\fP .br \fB\-selectbackground\fP \fIcolor\fP diff --git a/doc/ttk_entry.n b/doc/ttk_entry.n index 552700a..62b9951 100644 --- a/doc/ttk_entry.n +++ b/doc/ttk_entry.n @@ -26,7 +26,7 @@ standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command. \-class \-cursor \-font \-foreground \-style -\-takefocus \-xscrollcommand \-placeholder +\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-exportselection exportSelection ExportSelection @@ -454,6 +454,8 @@ Some themes use a graphical background and their field background colors cannot .br \fB\-padding\fP \fIpadding\fP .br +\fB\-placeholderforeground\fP \fIcolor\fP +.br \fB\-relief\fP \fIrelief\fP .br \fB\-selectbackground\fP \fIcolor\fP diff --git a/doc/ttk_spinbox.n b/doc/ttk_spinbox.n index c18f987..b8f3ca2 100644 --- a/doc/ttk_spinbox.n +++ b/doc/ttk_spinbox.n @@ -22,7 +22,7 @@ of the \fBttk::entry\fR widget including support of the to a Tcl variable. .SO ttk_widget \-class \-cursor \-state \-style -\-takefocus \-xscrollcommand \-placeholder +\-takefocus \-xscrollcommand \-placeholder \-placeholderforeground .SE .SO ttk_entry \-validate \-validatecommand @@ -111,6 +111,8 @@ value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored. .br \fB\-padding\fP \fIpadding\fP .br +\fB\-placeholderforeground\fP \fIcolor\fP +.br \fB\-selectbackground\fP \fIcolor\fP .br \fB\-selectforeground\fP \fIcolor\fP diff --git a/doc/ttk_widget.n b/doc/ttk_widget.n index 73affdd..17f1d88 100644 --- a/doc/ttk_widget.n +++ b/doc/ttk_widget.n @@ -152,13 +152,14 @@ to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value. .SH "ENTRY OPTIONS" -The following option is supported by entry, spinbox and combobox: +The following options are supported by entry, spinbox and combobox: .OP \-placeholder placeHolder PlaceHolder Specifies a help text string to display if no text is otherwise displayed, that is when the widget is empty. The placeholder text is displayed using -the values of the \fB\-font\fR and \fB\-justify\fR options. The foreground -color of the placeholder text can be changed using the -\fB\-placeholderforeground\fR style option. +the values of the \fB\-font\fR, \fB\-justify\fR and +\fB\-placeholderforeground\fR options. +.OP \-placeholderforeground placeHolderForeground PlaceHolderForeground +Specifies the foreground color of the placeholder text. .SH "COMPATIBILITY OPTIONS" This option is only available for themed widgets that have .QW corresponding diff --git a/macosx/README b/macosx/README index 9745d14..1c603df 100644 --- a/macosx/README +++ b/macosx/README @@ -272,20 +272,24 @@ appearance. Part of the implementation of the Dark Mode was to make some of the named NSColors have dynamic values. Apple calls these "semantic colors" because the name does not specify a specific color, but rather refers to the context in which the color should be used. -Tk now provides the following semantic colors as system colors: -systemTextColor, systemTextBackgroundColor, systemSelectedTextColor, -systemSelectedTextBackgroundColor, systemControlTextColor, -systemDisabledControlTextColor, systemLabelColor, systemLinkColor, and -systemControlAccentColor. All of these except the last three were -present in OSX 10.0 (and those three are simulated in systems where they -do not exist). The change in 10.14 was that the RGB color value of -these colors became dynamic, meaning that the color value can change -when the application appearance changes. In particular, when a user -selects Dark Mode in the system preferences these colors change -appearance. For example systemTextColor is dark in Aqua and light in -DarkAqua. One additional color, systemSelectedTabTextColor, does not -exist in macOS but is used by Tk to match the different colors used -for Notebook tab text in different OS versions. +In particular, when a user selects Dark Mode in the system preferences +these colors change appearance. For example systemTextColor is dark in +Aqua and light in DarkAqua. + +Tk now provides colors corresponding to all of the NSColors in Apple's System +ColorList. The convention for naming these colors is that the Tk name is +generated by capitalizing the macOS name and adding the prefix "system". The +System ColorList differs between releases of macOS and some colors, such as +systemLinkColor and systemControlAccentColor, are simulated on older systems +which did not provide them. The following colors are available on all +supported macOS releases, although newer systems will support additional +colors: systemControlAccentColor, systemControlTextColor, +systemDisabledControlTextColor, systemLabelColor, systemLinkColor, +systemPlaceholderTextColor, systemSelectedTextBackgroundColor, +systemSelectedTextColor, systemSeparatorColor, systemTextBackgroundColor, and +systemTextColor. One additional color, systemSelectedTabTextColor, does not +exist in macOS but is used by Tk to match the different colors used for +Notebook tab titles in different OS versions. The default background and foreground colors of most of the Tk widgets have been set to semantic colors, which means that the widgets will change diff --git a/macosx/tkMacOSXDefault.h b/macosx/tkMacOSXDefault.h index a71fbf2..8a6546f 100644 --- a/macosx/tkMacOSXDefault.h +++ b/macosx/tkMacOSXDefault.h @@ -193,7 +193,7 @@ #define DEF_ENTRY_INSERT_WIDTH "1" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" -#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" +#define DEF_ENTRY_PLACEHOLDERFG "systemPlaceholderTextColor" #define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index a2d6016..f3174ae 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -342,6 +342,18 @@ test entry-10.2 {configuration option: "-placeholderforeground"} -setup { destroy .e } -result {red} +test entry-10.3 {styling option: "-placeholderforeground"} -setup { + pack [ttk::entry .e] +} -body { + set current [ttk::style configure TEntry -placeholderforeground] + ttk::style configure TEntry -placeholderforeground blue + set res [ttk::style configure TEntry -placeholderforeground] + ttk::style configure TEntry -placeholderforeground $current + set res +} -cleanup { + destroy .e +} -result {blue} + test entry-11.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup { pack [ttk::entry .e] update diff --git a/unix/tkUnixDefault.h b/unix/tkUnixDefault.h index fa1f120..b59f7ae 100644 --- a/unix/tkUnixDefault.h +++ b/unix/tkUnixDefault.h @@ -22,6 +22,7 @@ * TROUGH - Background color for troughs in scales and scrollbars. * INDICATOR - Color for indicator when button is selected. * DISABLED - Foreground color when widget is disabled. + * PLACEHOLDER_FG - Foreground color for placeholder text. */ #define BLACK "#000000" @@ -33,6 +34,7 @@ #define TROUGH "#b3b3b3" #define INDICATOR WHITE #define DISABLED "#a3a3a3" +#define PLACEHOLDER_FG "#b3b3b3" /* grey70 */ /* * Defaults for labels, buttons, checkbuttons, and radiobuttons: @@ -153,7 +155,7 @@ #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" -#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" +#define DEF_ENTRY_PLACEHOLDERFG PLACEHOLDER_FG #define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" diff --git a/win/tkWinColor.c b/win/tkWinColor.c index 78e3b6c..ab43304 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -58,6 +58,7 @@ static const SystemColorEntry sysColors[] = { {"InfoText", COLOR_INFOTEXT}, {"Menu", COLOR_MENU}, {"MenuText", COLOR_MENUTEXT}, + {"PlaceHolderText", COLOR_GRAYTEXT}, {"Scrollbar", COLOR_SCROLLBAR}, {"Window", COLOR_WINDOW}, {"WindowFrame", COLOR_WINDOWFRAME}, diff --git a/win/tkWinDefault.h b/win/tkWinDefault.h index 33756f8..eaceb42 100644 --- a/win/tkWinDefault.h +++ b/win/tkWinDefault.h @@ -158,7 +158,7 @@ #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" -#define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" +#define DEF_ENTRY_PLACEHOLDERFG "SystemPlaceHolderText" #define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace" #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" |