| 
Dear Eric,   I know that bugzilla. Do you have an answer to: How can we reset the foreground / background color to the one defined in the current theme?   Regards, Matthias   
From: <platform-ui-dev-bounces@xxxxxxxxxxx> on behalf of Leo Ufimtsev <Leonidas@xxxxxxxxxx>Reply-To: "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
 Date: Friday, 23. June 2017 at 17:37
 To: "Eclipse Platform UI component developers list." <platform-ui-dev@xxxxxxxxxxx>
 Subject: Re: [platform-ui-dev] Question regarding theming
 
I'm in the process of adding "Information" user preference colors to Eclipse, with which you get the color of the current theme:'org.eclipse.ui.workbench.INFORMATION_BACKGROUND=52,57,61'
 'org.eclipse.ui.workbench.INFORMATION_FOREGROUND=238,238,238'
 
 https://bugs.eclipse.org/bugs/show_bug.cgi?id=508819
 We're using these colors for things like the javadoc hover tips etc.. If of use, let me know and I can send you examples of how to use it. This would require platform as dependency thou. 
  
On Fri, Jun 23, 2017 at 6:56 AM, Becker, Matthias <ma.becker@xxxxxxx> wrote: 
Dear Eric,
 thank you for your explanations. Maybe I rephrase my question.
 In one of our plugins we have the use-case, that we visualize
 a distinct semantic state by setting the foreground / background color
 of a control, e.g. with
 control.setForeground(…);
 and later remove that color with
 control.setForeground(null);
 
 But control.setForeground(null); set’s it back to the system color appropriate for that widget.
 In the Dark Theme where the widget is styled this is the wrong color (a light one instead of a dark one).
 
 How can we reset the foreground / background color to the one defined in the current theme?
 
 Regards,
 Matthias
 
On 22.06.17, 20:10, "platform-ui-dev-bounces@xxxxxxxxxxx on behalf of Eric Williams" <platform-ui-dev-bounces@xxxxxxxxxxx on behalf of
ericwill@xxxxxxxxxx> wrote:
 
 Hello,
 
 On 06/21/2017 11:24 AM, Becker, Matthias wrote:
 > Dear all,
 >
 > if I see it correct colors you obtain via
 > Display.getCurrent().getSystemColor( ) (e.g.
 > SWT.COLOR_WIDGET_BACKGROUND) are not adapted via the CSS theming.
 >
 > So all usages of Display.getCurrent().getSystemColor( ) are potential
 > causes for theming errors. Is there a clear guidance on the usage of
 > Display.getCurrent().getSystemColor( ) and possible alternatives?
 >
 > Is there an API to obtain e.g. the background color an SWT text widget
 > would get based on the current theme? I know I can call
 > Control.getBackground() to get the current background color of a given
 >
 > control but what to do if don’t have an instance of SWT.Text at hand?
 
 Display.getSystemColor() returns a color that is native to the operating
 system. These are the same colors you see for default OS widgets.
 On Linux this means parsing the currently running GTK theme and
 extracting certain color values from it.
 
 If an SWT widget is unstyled (it has no background and/or foreground
 colors set), then it should adhere to the colors found in
 Display.getSystemColors(). For example:
 
 Text/Table/Tree based widgets: COLOR_LIST_* (sometimes COLOR_TITLE_*)
 Buttons, Toolbars, other common widgets: COLOR_WIDGET_*
 Tooltips: COLOR_INFO_*
 Links: COLOR_LINK_*
 
 If a widget is indeed unstyled, then calling getBack/Foreground() on it
 should return the system color appropriate for that widget. If a widget
 is styled, calling setBack/Foreground(null) and then
 getBack/Foreground() will have the same effect.
 
 If you have no widget at hand, using the system colors will give you an
 idea of what that widget should look like by default. Using Text as an
 example, its background should be COLOR_LIST_BACKGROUND and the
 foreground should be COLOR_LIST_FOREGROUND. Selections/highlighting
 should be COLOR_LIST_SELECTION as the background and
 COLOR_LIST_SELECTION_TEXT as the foreground.
 
 
 --
 Eric Williams
 Associate Software Engineer - Eclipse Team
 Red Hat
 _______________________________________________
 platform-ui-dev mailing list
 platform-ui-dev@xxxxxxxxxxx
 To change your delivery options, retrieve your password, or unsubscribe from this list, visit
 https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
 
 _______________________________________________
 platform-ui-dev mailing list
 platform-ui-dev@xxxxxxxxxxx
 To change your delivery options, retrieve your password, or unsubscribe from this list, visit
 https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
 
 
 --
 |