Add UI color for multi-comp edit color

This commit is contained in:
SiboVG 2023-09-22 18:29:06 +02:00
parent ebb4186ccb
commit 08695a8ffb
3 changed files with 36 additions and 2 deletions

View File

@ -100,6 +100,7 @@ public class RocketComponentConfig extends JPanel {
private boolean allMassive; // Checks whether all listener components, and this component, are massive
private static Color darkWarningColor;
private static Color multiCompEditColor;
private static Border border;
static {
@ -203,6 +204,7 @@ public class RocketComponentConfig extends JPanel {
private static void updateColors() {
darkWarningColor = GUIUtil.getUITheme().getDarkWarningColor();
multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor();
border = GUIUtil.getUITheme().getBorder();
}
@ -270,7 +272,7 @@ public class RocketComponentConfig extends JPanel {
//// Multi-comp edit label
multiCompEditLabel = new StyledLabel(" ", -1, Style.BOLD);
multiCompEditLabel.setFontColor(new Color(170, 0, 100));
multiCompEditLabel.setFontColor(multiCompEditColor);
buttonPanel.add(multiCompEditLabel, "split 2");
//// Mass:

View File

@ -33,6 +33,7 @@ import net.sf.openrocket.document.events.DocumentChangeEvent;
import net.sf.openrocket.gui.components.ConfigurationComboBox;
import net.sf.openrocket.gui.components.StyledLabel;
import net.sf.openrocket.gui.util.GUIUtil;
import net.sf.openrocket.gui.util.UITheme;
import net.sf.openrocket.gui.widgets.SelectColorButton;
import net.sf.openrocket.l10n.Translator;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
@ -61,6 +62,12 @@ public class SimulationEditDialog extends JDialog {
private final boolean initialIsSaved; // Whether the document was saved before the dialog was opened
private boolean isModified = false; // Whether the simulation has been modified
private final boolean isNewSimulation; // Whether you are editing a new simulation, or an existing one
private static Color multiCompEditColor;
static {
initColors();
}
public SimulationEditDialog(Window parent, final OpenRocketDocument document, boolean isNewSimulation, Simulation... sims) {
//// Edit simulation
@ -102,6 +109,15 @@ public class SimulationEditDialog extends JDialog {
GUIUtil.setDisposableDialogOptions(this, null);
}
private static void initColors() {
updateColors();
UITheme.Theme.addUIThemeChangeListener(SimulationEditDialog::updateColors);
}
private static void updateColors() {
multiCompEditColor = GUIUtil.getUITheme().getMultiCompEditColor();
}
private boolean isSingleEdit() {
return simulationList.length == 1;
@ -247,7 +263,7 @@ public class SimulationEditDialog extends JDialog {
//// Multi-simulation edit
if (simulationList.length > 1) {
StyledLabel multiSimEditLabel = new StyledLabel("", -1, StyledLabel.Style.BOLD);
multiSimEditLabel.setFontColor(new Color(170, 0, 100));
multiSimEditLabel.setFontColor(multiCompEditColor);
multiSimEditLabel.setText(trans.get("simedtdlg.title.MultiSimEdit"));
StringBuilder components = new StringBuilder(trans.get("simedtdlg.title.MultiSimEdit.ttip"));
for (int i = 0; i < simulationList.length; i++) {

View File

@ -45,6 +45,7 @@ public class UITheme {
Color getRowBackgroundDarkerColor();
Color getFlightDataTextActiveColor();
Color getFlightDataTextInactiveColor();
Color getMultiCompEditColor();
// Component colors
String getDefaultBodyComponentColor();
@ -208,6 +209,11 @@ public class UITheme {
return new Color(0,0,127,127);
}
@Override
public Color getMultiCompEditColor() {
return new Color(170, 0, 100);
}
@Override
public String getDefaultBodyComponentColor() {
return "0,0,240";
@ -434,6 +440,11 @@ public class UITheme {
return new Color(128, 166, 230, 127);
}
@Override
public Color getMultiCompEditColor() {
return new Color(222, 146, 176);
}
@Override
public String getDefaultBodyComponentColor() {
return "150,162,255";
@ -668,6 +679,11 @@ public class UITheme {
return getCurrentTheme().getFlightDataTextInactiveColor();
}
@Override
public Color getMultiCompEditColor() {
return getCurrentTheme().getMultiCompEditColor();
}
@Override
public String getDefaultBodyComponentColor() {
return getCurrentTheme().getDefaultBodyComponentColor();