提交 e30bb455 编写于 作者: S serge-rider

Dark theme support


Former-commit-id: e114f33e
上级 73c974c9
......@@ -44,7 +44,7 @@ public class UIStyles {
}
public static boolean isDarkTheme() {
return UIUtils.isDark(getDefaultWidgetBackground().getRGB());
return UIUtils.isDark(getDefaultTextBackground().getRGB());
}
public static Color getDefaultWidgetBackground() {
......
......@@ -94,7 +94,6 @@ public class TabbedFolderComposite extends Composite implements ITabbedFolderCon
gd.heightHint = TabbedFolderList.SECTION_DIV_HEIGHT;
sash.setLayoutData(gd);
sash.addPaintListener(e -> {
e.gc.setBackground(folderList.widgetBackground);
e.gc.setForeground(folderList.widgetForeground);
e.gc.fillRectangle(0, 1, e.width, e.height - 2);
e.gc.setForeground(folderList.widgetNormalShadow);
......
......@@ -82,7 +82,6 @@ public class TabbedFolderList extends Composite {
private int tabsThatFitInComposite = NONE;
Color widgetForeground;
Color widgetBackground;
Color widgetNormalShadow;
Color widgetDarkShadow;
private Color listBackground;
......@@ -325,7 +324,6 @@ public class TabbedFolderList extends Composite {
* @param e the paint event.
*/
private void paint(PaintEvent e) {
e.gc.setBackground(widgetBackground);
e.gc.setForeground(widgetForeground);
Rectangle bounds = getBounds();
......@@ -409,7 +407,6 @@ public class TabbedFolderList extends Composite {
* @param e the paint event.
*/
private void paint(PaintEvent e) {
e.gc.setBackground(widgetBackground);
e.gc.setForeground(widgetForeground);
Rectangle bounds = getBounds();
......@@ -457,15 +454,16 @@ public class TabbedFolderList extends Composite {
public TabbedFolderList(Composite parent, boolean section) {
super(parent, SWT.NO_FOCUS);
CSSUtils.setCSSClass(this, "Composite");
//CSSUtils.setCSSClass(this, "MPartStack");
this.section = section;
removeAll();
setLayout(new FormLayout());
initColours();
initAccessible();
topNavigationElement = new TopNavigationElement(this);
bottomNavigationElement = new BottomNavigationElement(this);
initColours();
initAccessible();
this.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
......@@ -726,7 +724,15 @@ public class TabbedFolderList extends Composite {
ColorRegistry colorRegistry = UIUtils.getColorRegistry();
listBackground = UIStyles.getDefaultTextBackground();
widgetBackground = getBackground();
Color widgetBackground = getBackground();
if (UIUtils.isInDialog(this) && UIStyles.isDarkTheme()) {
// FIXME: hacking of dark theme
// By some reason E4 sets white background in dark theme.
widgetBackground = UIStyles.getDefaultTextBackground();
super.setBackground(widgetBackground);
topNavigationElement.setBackground(widgetBackground);
bottomNavigationElement.setBackground(widgetBackground);
}
widgetForeground = UIStyles.getDefaultTextForeground();
widgetDarkShadow = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
widgetNormalShadow = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册