diff --git a/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java b/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java index 45a1daa0..c40ca4f5 100644 --- a/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java +++ b/core/src/main/java/com/github/weisj/darklaf/task/AccentColorAdjustmentTask.java @@ -29,8 +29,7 @@ import java.util.List; import java.util.Properties; import java.util.logging.Logger; -import javax.swing.plaf.ColorUIResource; - +import com.github.weisj.darklaf.DarkColorUIResource; import com.github.weisj.darklaf.color.DarkColorModelHSB; import com.github.weisj.darklaf.theme.Theme; import com.github.weisj.darklaf.util.Pair; @@ -113,7 +112,7 @@ public class AccentColorAdjustmentTask extends ColorAdjustmentTask { Color color = DarkColorModelHSB.getColorFromHSBValues(mapValue(hsbMatch[0], info.hAdj), mapValue(hsbMatch[1], info.sAdj), mapValue(hsbMatch[2], info.bAdj)); - return new ColorUIResource(color); + return new DarkColorUIResource(color); } return obj; } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java index 4986956d..ab4282fc 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java @@ -152,6 +152,7 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener { @Override protected void installDefaults() { super.installDefaults(); + LookAndFeel.installColors(tree, "Tree.background", "Tree.foreground"); selectionBackground = UIManager.getColor("Tree.unfocusedSelectionBackground"); focusSelectionBackground = UIManager.getColor("Tree.selectionBackground"); focusSelectedLineColor = UIManager.getColor("Tree.lineFocusSelected"); diff --git a/property-loader/src/main/java/com/github/weisj/darklaf/DarkColorUIResource.java b/property-loader/src/main/java/com/github/weisj/darklaf/DarkColorUIResource.java new file mode 100644 index 00000000..aec0f570 --- /dev/null +++ b/property-loader/src/main/java/com/github/weisj/darklaf/DarkColorUIResource.java @@ -0,0 +1,58 @@ +/* + * 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 com.github.weisj.darklaf; + +import java.awt.*; + +import javax.swing.plaf.ColorUIResource; + +public class DarkColorUIResource extends ColorUIResource { + + public DarkColorUIResource(final int r, final int g, final int b) { + super(r, g, b); + } + + public DarkColorUIResource(final int rgb) { + super(rgb); + } + + public DarkColorUIResource(final float r, final float g, final float b) { + super(r, g, b); + } + + public DarkColorUIResource(final Color c) { + super(c); + } + + @Override + public Color darker() { + return new DarkColorUIResource(super.darker()); + } + + @Override + public Color brighter() { + return new DarkColorUIResource(super.brighter()); + } +} diff --git a/property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java b/property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java index 5eb15404..63759bf9 100644 --- a/property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java +++ b/property-loader/src/main/java/com/github/weisj/darklaf/PropertyLoader.java @@ -37,7 +37,6 @@ import java.util.logging.Logger; import java.util.stream.Collectors; import javax.swing.*; -import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.DimensionUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.plaf.InsetsUIResource; @@ -217,7 +216,7 @@ public final class PropertyLoader { ? Boolean.TRUE : PropertyValue.FALSE.equalsIgnoreCase(value) ? Boolean.FALSE : null; if (color != null && (value.length() == 6 || value.length() == 8)) { - return new ColorUIResource(color); + return new DarkColorUIResource(color); } else if (invVal != null) { return invVal; } else if (boolVal != null) { diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java index 944306ab..31eb7af2 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java @@ -782,6 +782,7 @@ public class WindowsTitlePane extends CustomTitlePane { } } else if (PropertyKey.TITLE.equals(name)) { titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString()); + doLayout(); repaint(); } else if (PropertyKey.COMPONENT_ORIENTATION.equals(name)) { revalidate();