Fix coloring of disabled optimization parameters in dark mode

This commit is contained in:
SiboVG 2023-11-19 03:53:09 +01:00
parent 8f4ccd747a
commit 06a7999ba4
2 changed files with 31 additions and 5 deletions

View File

@ -42,6 +42,7 @@ public class SimulationModifierTree extends BasicTree {
private static Color textColor; private static Color textColor;
private static Color dimTextColor; private static Color dimTextColor;
private static Color disabledTextColor;
private static Color textSelectionForegroundColor; private static Color textSelectionForegroundColor;
private static Color textSelectionBackgroundColor; private static Color textSelectionBackgroundColor;
@ -77,6 +78,7 @@ public class SimulationModifierTree extends BasicTree {
private static void updateColors() { private static void updateColors() {
textColor = GUIUtil.getUITheme().getTextColor(); textColor = GUIUtil.getUITheme().getTextColor();
dimTextColor = GUIUtil.getUITheme().getDimTextColor(); dimTextColor = GUIUtil.getUITheme().getDimTextColor();
disabledTextColor = GUIUtil.getUITheme().getDisabledTextColor();
textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor(); textSelectionForegroundColor = GUIUtil.getUITheme().getTextSelectionForegroundColor();
textSelectionBackgroundColor = GUIUtil.getUITheme().getTextSelectionBackgroundColor(); textSelectionBackgroundColor = GUIUtil.getUITheme().getTextSelectionBackgroundColor();
} }
@ -197,16 +199,18 @@ public class SimulationModifierTree extends BasicTree {
setForeground(dimTextColor); setForeground(dimTextColor);
setFont(stringFont); setFont(stringFont);
} else if (object instanceof SimulationModifier) { } else if (object instanceof SimulationModifier) {
boolean isSelected = tree.getSelectionRows() != null && IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row);
if (isSelected) {
setBackground(textSelectionBackgroundColor);
setOpaque(true);
}
if (selectedModifiers.contains(object)) { if (selectedModifiers.contains(object)) {
setForeground(dimTextColor); setForeground(disabledTextColor);
setFont(stringFont); setFont(stringFont);
} else { } else {
if (tree.getSelectionRows() != null && if (isSelected) {
IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) {
setForeground(textSelectionForegroundColor); setForeground(textSelectionForegroundColor);
setBackground(textSelectionBackgroundColor);
setOpaque(true);
} else { } else {
setForeground(textColor); setForeground(textColor);
} }

View File

@ -38,6 +38,7 @@ public class UITheme {
Color getBorderColor(); Color getBorderColor();
Color getTextColor(); Color getTextColor();
Color getDimTextColor(); Color getDimTextColor();
Color getDisabledTextColor();
Color getTextSelectionForegroundColor(); Color getTextSelectionForegroundColor();
Color getTextSelectionBackgroundColor(); Color getTextSelectionBackgroundColor();
Color getWarningColor(); Color getWarningColor();
@ -205,6 +206,11 @@ public class UITheme {
return Color.GRAY; return Color.GRAY;
} }
@Override
public Color getDisabledTextColor() {
return getDimTextColor();
}
@Override @Override
public Color getTextSelectionForegroundColor() { public Color getTextSelectionForegroundColor() {
return UIManager.getColor("Tree.selectionForeground"); return UIManager.getColor("Tree.selectionForeground");
@ -567,6 +573,11 @@ public class UITheme {
return new Color(182, 182, 182); return new Color(182, 182, 182);
} }
@Override
public Color getDisabledTextColor() {
return new Color(161, 161, 161);
}
@Override @Override
public Color getTextSelectionForegroundColor() { public Color getTextSelectionForegroundColor() {
return Color.WHITE; return Color.WHITE;
@ -925,6 +936,12 @@ public class UITheme {
return new Color(165, 171, 184); return new Color(165, 171, 184);
} }
@Override
public Color getDisabledTextColor() {
return new Color(128, 128, 128);
}
@Override @Override
public Color getTextSelectionForegroundColor() { public Color getTextSelectionForegroundColor() {
return Color.WHITE; return Color.WHITE;
@ -1296,6 +1313,11 @@ public class UITheme {
return getCurrentTheme().getDimTextColor(); return getCurrentTheme().getDimTextColor();
} }
@Override
public Color getDisabledTextColor() {
return getCurrentTheme().getDisabledTextColor();
}
@Override @Override
public Color getTextSelectionForegroundColor() { public Color getTextSelectionForegroundColor() {
return getCurrentTheme().getTextSelectionForegroundColor(); return getCurrentTheme().getTextSelectionForegroundColor();