Changed colors management in the displaying of the themes settings

screen.
This commit is contained in:
DieGurke 2019-12-14 12:54:32 +01:00
parent 6ab38e1e1a
commit 59dff7bf25

View File

@ -138,11 +138,6 @@ public class SettingsScreen extends JDialog {
Theme theme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme());
options.setSelectionForeground(theme.getUserNameColor());
options.setSelectionBackground(theme.getSelectionColor());
options.setForeground(theme.getUserNameColor());
options.setBackground(theme.getCellColor());
GridBagConstraints gbc_optionsList = new GridBagConstraints();
gbc_optionsList.fill = GridBagConstraints.BOTH;
gbc_optionsList.gridx = 0;
@ -164,9 +159,6 @@ public class SettingsScreen extends JDialog {
GridBagLayout gbl_themeLayout = new GridBagLayout();
themeContent.setForeground(theme.getUserNameColor());
themeContent.setBackground(theme.getCellColor());
gbl_themeLayout.columnWidths = new int[] { 1, 1 };
gbl_themeLayout.rowHeights = new int[] { 1, 1 };
gbl_themeLayout.columnWeights = new double[] { 1.0, 1.0 };
@ -174,8 +166,6 @@ public class SettingsScreen extends JDialog {
themeContent.setLayout(gbl_themeLayout);
themes.setBackground(theme.getUserNameColor());
themes.setForeground(theme.getBackgroundColor());
themes.setSelectedItem(Settings.getInstance().getCurrentTheme());
themes.addItemListener(new ItemListener() {
@ -300,8 +290,6 @@ public class SettingsScreen extends JDialog {
contentPanel.revalidate();
contentPanel.repaint();
// TODO: Create new Theme
} catch (Exception e) {
logger.info("New theme couldn't be created! " + e);
e.printStackTrace();
@ -397,8 +385,8 @@ public class SettingsScreen extends JDialog {
themeContent.setForeground(theme.getUserNameColor());
themeContent.setBackground(theme.getCellColor());
// themes
themes.setBackground(theme.getUserNameColor());
themes.setForeground(theme.getBackgroundColor());
themes.setBackground(theme.getBackgroundColor());
themes.setForeground(getInvertedColor(theme.getBackgroundColor()));
createNewThemeButton.setBackground(theme.getInteractableBackgroundColor());
createNewThemeButton.setForeground(theme.getInteractableForegroundColor());
@ -517,7 +505,7 @@ public class SettingsScreen extends JDialog {
String name, int yIndex) {
textPane.setFont(new Font("Arial", Font.PLAIN, 14));
textPane.setBackground(theme.getBackgroundColor());
textPane.setForeground(theme.getUserNameColor());
textPane.setForeground(getInvertedColor(theme.getBackgroundColor()));
textPane.setText(name);
textPane.setEditable(false);
@ -532,11 +520,11 @@ public class SettingsScreen extends JDialog {
System.out.println(color.getRGB());
// TODO: When Theme changed in same settings screen, color variable doesnt
// update.
temporaryTheme.setColor(yIndex, newColor);
colorChanged = true;
createNewThemeButton.setEnabled(true);
}
button.setBackground(newColor);
temporaryTheme.setColor(yIndex, newColor);
colorChanged = true;
createNewThemeButton.setEnabled(true);
}
button.setBackground(newColor);
} catch (Exception e) {
logger.info("An error occured while opening Color Chooser: " + e);
@ -544,9 +532,16 @@ public class SettingsScreen extends JDialog {
}
});
panel.add(textPane);panel.add(button);panel.setBackground(theme.getCellColor());panel.setAlignmentX(Component.LEFT_ALIGNMENT);
panel.add(textPane);
panel.add(button);
panel.setBackground(theme.getCellColor());
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
colorsPanel.add(panel);
}
colorsPanel.add(panel);
}
private Color getInvertedColor(Color color) {
return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue());
}
}