Browse Source

Add color palette consisting of 13 colors compatible with the themes color scheme.

pull/222/head
weisj 4 years ago
parent
commit
9b49c7af87
  1. 1
      core/src/main/java/com/github/weisj/darklaf/components/color/QuickColorChooser.java
  2. 86
      core/src/test/java/theme/ColorPaletteDemo.java
  3. 11
      theme/src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java
  4. 8
      theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastDarkTheme.java
  5. 8
      theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastLightTheme.java
  6. 39
      theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_icons.properties
  7. 14
      theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/dark_icons.properties
  8. 14
      theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/light_icons.properties
  9. 14
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons.properties
  10. 14
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_icons.properties
  11. 14
      theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_icons.properties

1
core/src/main/java/com/github/weisj/darklaf/components/color/QuickColorChooser.java

@ -58,6 +58,7 @@ public class QuickColorChooser extends JPanel {
public QuickColorChooser(final String title, final Color color, final BiConsumer<Boolean, Color> onStatusChange, public QuickColorChooser(final String title, final Color color, final BiConsumer<Boolean, Color> onStatusChange,
final boolean showCheckBox, final Dimension pickerSize) { final boolean showCheckBox, final Dimension pickerSize) {
setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
setAlignmentX(JComponent.LEFT_ALIGNMENT);
if (showCheckBox) { if (showCheckBox) {
checkBox = new JCheckBox(); checkBox = new JCheckBox();
checkBox.addActionListener(e -> onStatusChange.accept(isSelected(), getColor())); checkBox.addActionListener(e -> onStatusChange.accept(isSelected(), getColor()));

86
core/src/test/java/theme/ColorPaletteDemo.java

@ -0,0 +1,86 @@
/*
* MIT License
*
* Copyright (c) 2020 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
package theme;
import javax.swing.*;
import ui.ComponentDemo;
import com.github.weisj.darklaf.graphics.ThemedColor;
import com.github.weisj.darklaf.icons.SolidColorIcon;
import com.github.weisj.darklaf.layout.LayoutHelper;
import com.github.weisj.darklaf.theme.OneDarkTheme;
import com.github.weisj.darklaf.theme.Theme;
public class ColorPaletteDemo implements ComponentDemo {
public static void main(final String[] args) {
ComponentDemo.showDemo(new ColorPaletteDemo());
}
@Override
public JComponent createComponent() {
JComponent comp = Box.createVerticalBox();
comp.add(Box.createVerticalStrut(5));
String[] names = {
"palette.yellow",
"palette.orange",
"palette.red",
"palette.pink",
"palette.purple",
"palette.indigo",
"palette.blue",
"palette.teal",
"palette.cyan",
"palette.green",
"palette.lime",
"palette.forest",
"palette.brown",
};
{
JComponent p = Box.createVerticalBox();
p.setBorder(LayoutHelper.createEmptyContainerBorder());
for (String name : names) {
p.add(Box.createVerticalStrut(5));
p.add(new JLabel(name, new SolidColorIcon(new ThemedColor(name), 32, 32), JLabel.LEFT));
}
comp.add(p);
comp.add(Box.createVerticalStrut(5));
}
return comp;
}
@Override
public Theme createTheme() {
return new OneDarkTheme();
}
@Override
public String getTitle() {
return "Color Palette";
}
}

11
theme/src/main/java/com/github/weisj/darklaf/theme/DarculaTheme.java

@ -21,6 +21,11 @@
*/ */
package com.github.weisj.darklaf.theme; package com.github.weisj.darklaf.theme;
import java.util.Properties;
import javax.swing.*;
import com.github.weisj.darklaf.PropertyLoader;
import com.github.weisj.darklaf.annotations.SynthesiseLaf; import com.github.weisj.darklaf.annotations.SynthesiseLaf;
import com.github.weisj.darklaf.theme.info.ColorToneRule; import com.github.weisj.darklaf.theme.info.ColorToneRule;
import com.github.weisj.darklaf.theme.info.PresetIconRule; import com.github.weisj.darklaf.theme.info.PresetIconRule;
@ -70,4 +75,10 @@ public class DarculaTheme extends Theme {
public boolean supportsCustomSelectionColor() { public boolean supportsCustomSelectionColor() {
return true; return true;
} }
@Override
public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) {
super.customizeIconTheme(properties, currentDefaults);
PropertyLoader.putProperties(loadPropertyFile("icons"), properties, currentDefaults);
}
} }

8
theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastDarkTheme.java

@ -37,7 +37,7 @@ public class HighContrastDarkTheme extends Theme {
@Override @Override
protected PresetIconRule getPresetIconRule() { protected PresetIconRule getPresetIconRule() {
return PresetIconRule.NONE; return PresetIconRule.DARK;
} }
@Override @Override
@ -81,4 +81,10 @@ public class HighContrastDarkTheme extends Theme {
super.customizePlatformProperties(properties, currentDefaults); super.customizePlatformProperties(properties, currentDefaults);
loadCustomProperties("platform", properties, currentDefaults); loadCustomProperties("platform", properties, currentDefaults);
} }
@Override
public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) {
super.customizeIconTheme(properties, currentDefaults);
loadCustomProperties("icons", properties, currentDefaults);
}
} }

8
theme/src/main/java/com/github/weisj/darklaf/theme/HighContrastLightTheme.java

@ -37,7 +37,7 @@ public class HighContrastLightTheme extends Theme {
@Override @Override
protected PresetIconRule getPresetIconRule() { protected PresetIconRule getPresetIconRule() {
return PresetIconRule.NONE; return PresetIconRule.LIGHT;
} }
@Override @Override
@ -81,4 +81,10 @@ public class HighContrastLightTheme extends Theme {
super.customizePlatformProperties(properties, currentDefaults); super.customizePlatformProperties(properties, currentDefaults);
loadCustomProperties("platform", properties, currentDefaults); loadCustomProperties("platform", properties, currentDefaults);
} }
@Override
public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) {
super.customizeIconTheme(properties, currentDefaults);
loadCustomProperties("icons", properties, currentDefaults);
}
} }

39
theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_icons.properties

@ -0,0 +1,39 @@
#
# MIT License
#
# Copyright (c) 2020 Jannis Weis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
#
# suppress inspection "UnusedProperty" for whole file
#
%palette.yellow = FFC66D
%palette.orange = CC7832
%palette.red = BC3F32
%palette.pink = AE8ABE
%palette.purple = AB51BA
%palette.indigo = 507874
%palette.blue = 5394EC
%palette.teal = 6897BB
%palette.cyan = 299999
%palette.green = 629755
%palette.lime = A8C023
%palette.forest = 007F00
%palette.brown = 8A653B

14
theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/dark_icons.properties

@ -51,3 +51,17 @@
%informationIconColor = 3592C4 %informationIconColor = 3592C4
%warningIconColor = F0A732 %warningIconColor = F0A732
%questionIconColor = 3592C4 %questionIconColor = 3592C4
%palette.yellow = FFD60A
%palette.orange = FF9F0A
%palette.red = FF453A
%palette.pink = FF375F
%palette.purple = BF5AF2
%palette.indigo = 5E5CE6
%palette.blue = 0A84FF
%palette.teal = 64D2FF
%palette.cyan = 2DCCC3
%palette.green = 32D74B
%palette.lime = 69B320
%palette.forest = 13591E
%palette.brown = AC8E68

14
theme/src/main/resources/com/github/weisj/darklaf/theme/icon_presets/light_icons.properties

@ -51,3 +51,17 @@
%informationIconColor = 389FD6 %informationIconColor = 389FD6
%warningIconColor = e2a53a %warningIconColor = e2a53a
%questionIconColor = 389FD6 %questionIconColor = 389FD6
%palette.yellow = FFCC00
%palette.orange = FF9500
%palette.red = FF3B30
%palette.pink = FF2D55
%palette.purple = AF52DE
%palette.indigo = 5856D6
%palette.blue = 007AFF
%palette.teal = 5AC8FA
%palette.cyan = 31DCD1
%palette.green = 28CD41
%palette.lime = 93FA2D
%palette.forest = 176F24
%palette.brown = A2845E

14
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons.properties

@ -51,3 +51,17 @@
%informationIconColor = 4269b9 %informationIconColor = 4269b9
%warningIconColor = 8c812b %warningIconColor = 8c812b
%questionIconColor = 4269b9 %questionIconColor = 4269b9
%palette.yellow = E5C07B
%palette.orange = FF8C00
%palette.red = EF596F
%palette.pink = C678DD
%palette.purple = A03BA8
%palette.indigo = 5E5CE6
%palette.blue = 0A84FF
%palette.teal = 61AFEF
%palette.cyan = 2BBAC5
%palette.green = 89CA78
%palette.lime = 69B320
%palette.forest = 13591E
%palette.brown = AC8E68

14
theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_dark/solarized_dark_icons.properties

@ -51,3 +51,17 @@
%informationIconColor = 598bff %informationIconColor = 598bff
%warningIconColor = b58900 %warningIconColor = b58900
%questionIconColor = 598bff %questionIconColor = 598bff
%palette.yellow = B58900
%palette.orange = CB4B16
%palette.red = DC322F
%palette.pink = D33682
%palette.purple = AB52CC
%palette.indigo = 6C71C4
%palette.blue = 268BD2
%palette.teal = 2EB1BF
%palette.cyan = 2AA198
%palette.green = 2A822A
%palette.forest = 365936
%palette.lime = 859900
%palette.brown = 584E31

14
theme/src/main/resources/com/github/weisj/darklaf/theme/solarized_light/solarized_light_icons.properties

@ -51,3 +51,17 @@
%informationIconColor = 268BD2 %informationIconColor = 268BD2
%warningIconColor = B58900 %warningIconColor = B58900
%questionIconColor = 268BD2 %questionIconColor = 268BD2
%palette.yellow = B58900
%palette.orange = CB4B16
%palette.red = DC322F
%palette.pink = D33682
%palette.purple = AB52CC
%palette.indigo = 6C71C4
%palette.blue = 268BD2
%palette.teal = 2EB1BF
%palette.cyan = 2AA198
%palette.green = 2A822A
%palette.forest = 365936
%palette.lime = 859900
%palette.brown = 584E31

Loading…
Cancel
Save