diff --git a/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java b/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java index 395b0a82..9c886646 100644 --- a/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java +++ b/core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java @@ -228,7 +228,7 @@ public class PaintUtil { arcSize -= stroke; g.translate(lw, lw); - roundRect.setRoundRect(x, y, width - 2 * lw, height - 2, arcSize, arcSize); + roundRect.setRoundRect(x, y, width - 2 * lw, height - 2 * lw, arcSize, arcSize); g.fill(roundRect); g.translate(-lw, -lw); context.restore(); 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 031f1a63..e5be1a9f 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 @@ -88,7 +88,8 @@ public class AccentColorAdjustmentTask extends ColorAdjustmentTask { properties.put(info.key, c); } else { LOGGER.warning("Color with key '" + info.key - + "' could not be adjusted because the value '" + c + "' is not a color"); + + "' could not be adjusted because the value '" + c + ", '" + c.getClass() + + " is not a color"); } } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java index a8bdfe0e..bd1d28a1 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java @@ -208,7 +208,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { if (effectiveArc == 0) { g2.fillRect(x, y, width, height); } else { - PaintUtil.fillRoundRect(g2, x, y, width, height, effectiveArc, true); + PaintUtil.fillRoundRect(g2, x, y, width, height, effectiveArc, false); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java b/core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java index 543e9161..1f87ad69 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/cell/CellUtil.java @@ -129,6 +129,7 @@ public class CellUtil { private static Color listCellBackground; private static Color listCellBackgroundAlternative; private static Color listCellBackgroundSelected; + private static Color comboListCellBackgroundSelected; private static Color listCellBackgroundNoFocus; private static Color listCellBackgroundNoFocusAlternative; private static Color listCellBackgroundSelectedNoFocus; @@ -231,6 +232,7 @@ public class CellUtil { listCellBackground = d.getColor("List.background"); listCellBackgroundAlternative = d.getColor("List.backgroundAlternative"); listCellBackgroundSelected = d.getColor("List.backgroundSelected"); + comboListCellBackgroundSelected = d.getColor("ComboBox.selectionBackground"); listCellBackgroundNoFocus = d.getColor("List.backgroundNoFocus"); listCellBackgroundNoFocusAlternative = d.getColor("List.backgroundNoFocusAlternative"); listCellBackgroundSelectedNoFocus = d.getColor("List.backgroundSelectedNoFocus"); @@ -366,9 +368,10 @@ public class CellUtil { public static void setupListBackground(final Component comp, final JList parent, final boolean selected, final boolean altRow) { boolean alt = altRow && PropertyUtil.getBooleanProperty(parent, DarkListUI.KEY_ALTERNATE_ROW_COLOR); + boolean comboList = PropertyUtil.getBooleanProperty(parent, DarkListUI.KEY_IS_COMBO_LIST); setupBackground(comp, hasFocus(parent, comp), selected, alt ? listCellBackgroundAlternative : listCellBackground, - listCellBackgroundSelected, + comboList ? comboListCellBackgroundSelected : listCellBackgroundSelected, alt ? listCellBackgroundNoFocusAlternative : listCellBackgroundNoFocus, listCellBackgroundSelectedNoFocus, alt ? listCellInactiveBackgroundAlternative : listCellInactiveBackground, diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java index ec91910b..c9e82fee 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java @@ -40,6 +40,7 @@ import javax.swing.plaf.basic.ComboPopup; import com.github.weisj.darklaf.components.ArrowButton; import com.github.weisj.darklaf.delegate.LayoutManagerDelegate; import com.github.weisj.darklaf.graphics.PaintUtil; +import com.github.weisj.darklaf.ui.list.DarkDefaultListCellRenderer; import com.github.weisj.darklaf.ui.list.DarkListCellRendererDelegate; import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.PropertyKey; @@ -131,7 +132,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants @Override protected ListCellRenderer createRenderer() { - return new DarkListCellRendererDelegate(); + return new DarkDefaultListCellRenderer(); } @Override diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java index 49f324c0..5ef465fc 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java @@ -33,6 +33,7 @@ import javax.swing.*; import javax.swing.plaf.basic.BasicComboPopup; import com.github.weisj.darklaf.components.OverlayScrollPane; +import com.github.weisj.darklaf.ui.list.DarkListUI; import com.github.weisj.darklaf.ui.scrollpane.DarkScrollBarUI; import com.github.weisj.darklaf.util.DarkUIUtil; @@ -69,6 +70,13 @@ public class DarkComboPopup extends BasicComboPopup { this.borderSize = borderSize; } + @Override + protected JList createList() { + JList list = super.createList(); + list.putClientProperty(DarkListUI.KEY_IS_COMBO_LIST, true); + return list; + } + @Override protected void firePopupMenuWillBecomeVisible() { if (list.getModel().getSize() != 0) { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java index 3921422f..04b504dc 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUI.java @@ -42,6 +42,7 @@ import com.github.weisj.darklaf.util.PropertyUtil; public class DarkListUI extends DarkListUIBridge { protected static final String KEY_PREFIX = "JList."; + public static final String KEY_IS_COMBO_LIST = KEY_PREFIX + ".isComboList"; public static final String KEY_ALTERNATE_ROW_COLOR = KEY_PREFIX + "alternateRowColor"; public static final String KEY_RENDER_BOOLEAN_AS_CHECKBOX = KEY_PREFIX + "renderBooleanAsCheckBox"; public static final String KEY_BOOLEAN_RENDER_TYPE = KEY_PREFIX + "booleanRenderType"; diff --git a/core/src/test/java/ui/ComponentDemo.java b/core/src/test/java/ui/ComponentDemo.java index 0b183ada..3d2fb415 100644 --- a/core/src/test/java/ui/ComponentDemo.java +++ b/core/src/test/java/ui/ComponentDemo.java @@ -39,14 +39,12 @@ import javax.swing.event.MenuListener; import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.graphics.ImageUtil; import com.github.weisj.darklaf.settings.ThemeSettings; -import com.github.weisj.darklaf.theme.IntelliJTheme; import com.github.weisj.darklaf.theme.Theme; import com.github.weisj.darklaf.theme.info.PreferredThemeStyle; public interface ComponentDemo { static Theme getTheme() { - if (true) return new IntelliJTheme(); PreferredThemeStyle themeStyle = LafManager.getPreferredThemeStyle(); return LafManager.themeForPreferredStyle(new PreferredThemeStyle(themeStyle.getContrastRule(), themeStyle.getColorToneRule())); diff --git a/theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java b/theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java index 68276605..525bb28c 100644 --- a/theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java +++ b/theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java @@ -68,6 +68,16 @@ public class OneDarkTheme extends Theme { loadCustomProperties("ui", properties, currentDefaults); } + @Override + public boolean supportsCustomAccentColor() { + return true; + } + + @Override + public boolean supportsCustomSelectionColor() { + return true; + } + @Override public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) { super.customizeIconTheme(properties, currentDefaults); diff --git a/theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_accents.properties b/theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_accents.properties index 16a925ae..8bf01a38 100644 --- a/theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_accents.properties +++ b/theme/src/main/resources/com/github/weisj/darklaf/theme/darcula/darcula_accents.properties @@ -43,4 +43,3 @@ accent.propertyList = {widgetFillDefault:[100,100,100];\ selection.propertyList = {textCompSelectionBackground} selectionForeground.propertyList = {textCompSelectionBackground:textCompSelectionForeground} -accentForeground.propertyList = {} diff --git a/theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_accents.properties b/theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_accents.properties index 8b967369..03c9e0ff 100644 --- a/theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_accents.properties +++ b/theme/src/main/resources/com/github/weisj/darklaf/theme/intellij/intellij_accents.properties @@ -43,4 +43,3 @@ accent.propertyList = {widgetFillDefault:[100,100,100];\ selection.propertyList = {textCompSelectionBackground} selectionForeground.propertyList = {%textCompSelectionBackground:textCompSelectionForeground} -accentForeground.propertyList = {} diff --git a/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_accents.properties b/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_accents.properties new file mode 100644 index 00000000..2f934304 --- /dev/null +++ b/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_accents.properties @@ -0,0 +1,48 @@ +# +# 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 +# +accent.propertyList = {widgetFillDefault:[100,100,100];\ + hoverHighlightDefault:[100,80,80];\ + clickHighlightDefault:[100,90,85];\ + widgetBorderDefault:[100,80,110];\ + controlBorderFocus:[100,90,116];\ + controlBorderFocusSelected:[100,90,116];\ + glowFocusLine:[100,90,116];\ + glowFocus:[100,120,155];\ + borderFocus:[100,76,122];\ + highlightFill:[100,80,45];\ + highlightFillFocus:[100,100,80];\ + highlightFillFocusSecondary:[100,110,100];\ + highlightFillMono:[100,50,50];\ + controlFillHighlight:[100,100,100];\ + controlFillSecondary:[100,100,100];\ + controlFadeStart:[100,100,100];\ + controlFadeEnd:[100,50,30];\ + controlFillHighlightDisabled:[100,77,50];\ + hyperlink:[100,100,100]} +selection.propertyList = {textCompSelectionBackground} + +selectionForeground.propertyList = {textCompSelectionBackground:textCompSelectionForeground} diff --git a/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties b/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties index 8842d046..cee97e78 100644 --- a/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties +++ b/theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties @@ -66,7 +66,7 @@ Theme.highContrast = false %clickHighlightColorful = 333841 %hoverHighlightDefault = 7AA3F5 -%clickHighlightDefault = 689/F3 +%clickHighlightDefault = 6897F3 %hoverHighlightSecondary = 323844 %clickHighlightSecondary = 323844