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

View File

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