From dd14843f2ede20403045e032d181e2be50e8894f Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 6 Aug 2021 17:35:55 +0200 Subject: [PATCH 01/12] Accent color: reduced number of individual blueish accent colors with color functions (issue #233) --- .../formdev/flatlaf/FlatDarkLaf.properties | 22 ++++---- .../flatlaf/FlatIntelliJLaf.properties | 7 ++- .../formdev/flatlaf/FlatLightLaf.properties | 14 +++--- .../flatlaf/swingx/FlatDarkLaf.properties | 2 +- .../flatlaf/swingx/FlatLightLaf.properties | 2 +- .../uidefaults/FlatDarculaLaf_1.8.0_202.txt | 2 +- .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 50 +++++++++---------- .../uidefaults/FlatIntelliJLaf_1.8.0_202.txt | 20 ++++---- .../uidefaults/FlatLightLaf_1.8.0_202.txt | 42 ++++++++-------- 9 files changed, 80 insertions(+), 81 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 3dcd9fd5..edd17490 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -36,7 +36,7 @@ @foreground = #bbb @selectionBackground = #4B6EAF @selectionForeground = @foreground -@selectionInactiveBackground = #0D293E +@selectionInactiveBackground =spin(saturate(shade(@selectionBackground,70%),20%),-15) @selectionInactiveForeground = @foreground @disabledText = #888 @textComponentBackground = #45494A @@ -79,7 +79,7 @@ Button.selectedBackground = lighten($Button.background,10%,derived) Button.selectedForeground = @foreground Button.disabledSelectedBackground = lighten($Button.background,3%,derived) -Button.borderColor = #5e6060 +Button.borderColor = tint($Button.background,10%) Button.disabledBorderColor = $Button.borderColor Button.focusedBorderColor = $Component.focusedBorderColor Button.hoverBorderColor = $Button.focusedBorderColor @@ -87,13 +87,13 @@ Button.hoverBorderColor = $Button.focusedBorderColor Button.innerFocusWidth = 1 Button.default.background = #365880 -Button.default.foreground = #bbb +Button.default.foreground = @foreground Button.default.hoverBackground = lighten($Button.default.background,3%,derived) Button.default.pressedBackground = lighten($Button.default.background,6%,derived) -Button.default.borderColor = #4c708c -Button.default.hoverBorderColor = #537699 -Button.default.focusedBorderColor = #537699 -Button.default.focusColor = #43688c +Button.default.borderColor = tint($Button.default.background,15%) +Button.default.hoverBorderColor = tint($Button.default.background,18%) +Button.default.focusedBorderColor = $Button.default.hoverBorderColor +Button.default.focusColor = lighten($Component.focusColor,3%) Button.default.boldText = true Button.toolbar.hoverBackground = lighten($Button.background,1%,derived) @@ -116,7 +116,7 @@ CheckBox.icon.disabledBackground = @background CheckBox.icon.disabledCheckmarkColor = #606060 # focused -CheckBox.icon.focusedBorderColor = #466D94 +CheckBox.icon.focusedBorderColor = $Component.focusedBorderColor CheckBox.icon.focusedBackground = fade($CheckBox.icon.focusedBorderColor,30%) # hover @@ -146,8 +146,8 @@ ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) #---- Component ---- Component.borderColor = #646464 -Component.disabledBorderColor = #646464 -Component.focusedBorderColor = #466d94 +Component.disabledBorderColor = $Component.borderColor +Component.focusedBorderColor = lighten($Component.focusColor,5%) Component.focusColor = #3d6185 Component.linkColor = #589df6 Component.grayFilter = -20,-70,100 @@ -276,7 +276,7 @@ SplitPaneDivider.draggingColor = #646464 TabbedPane.underlineColor = #4A88C7 TabbedPane.disabledUnderlineColor = #7a7a7a TabbedPane.hoverColor = darken($TabbedPane.background,5%,derived noAutoInverse) -TabbedPane.focusColor = #3d4b5c +TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,25%) TabbedPane.contentAreaColor = #646464 TabbedPane.buttonHoverBackground = darken($TabbedPane.background,5%,derived noAutoInverse) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index 550459f4..e3cd5d67 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -38,10 +38,9 @@ Button.focusedBackground = null Button.default.background = #4D8AC9 Button.default.foreground = #fff Button.default.focusedBackground = null -Button.default.borderColor = #3D75B2 -Button.default.hoverBorderColor = #A9C9F5 -Button.default.focusedBorderColor = #A9C9F5 -Button.default.focusColor = #97c3f3 +Button.default.borderColor = shade($Button.default.background,15%) +Button.default.hoverBorderColor = tint($Button.default.background,50%) +Button.default.focusedBorderColor = $Button.default.hoverBorderColor Button.default.boldText = true Button.default.borderWidth = 1 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index d7fbce53..fa21ede5 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -73,7 +73,7 @@ controlDkShadow = darken($controlShadow,15%) #---- Button ---- Button.background = #fff -Button.focusedBackground = #e3f1fa +Button.focusedBackground = changeLightness(@selectionBackground,95%) Button.hoverBackground = darken($Button.background,3%,derived) Button.pressedBackground = darken($Button.background,10%,derived) Button.selectedBackground = darken($Button.background,20%,derived) @@ -118,7 +118,7 @@ CheckBox.icon.disabledBackground = @background CheckBox.icon.disabledCheckmarkColor = #ABABAB # focused -CheckBox.icon.focusedBorderColor = #7B9FC7 +CheckBox.icon.focusedBorderColor = shade($Component.focusedBorderColor,10%) CheckBox.icon.focusedBackground = $Button.focusedBackground # hover @@ -131,11 +131,11 @@ CheckBox.icon.pressedBackground = $Button.pressedBackground # used if CheckBox.icon.style = filled # enabled -CheckBox.icon[filled].selectedBorderColor = #4B97D9 +CheckBox.icon[filled].selectedBorderColor = shade($CheckBox.icon[filled].selectedBackground,5%) CheckBox.icon[filled].selectedBackground = #4F9EE3 CheckBox.icon[filled].checkmarkColor = #fff # focused -CheckBox.icon[filled].selectedFocusedBorderColor = #ACCFF7 +CheckBox.icon[filled].selectedFocusedBorderColor = tint($CheckBox.icon[filled].selectedBackground,50%) CheckBox.icon[filled].selectedFocusedBackground = $CheckBox.icon[filled].selectedBackground CheckBox.icon[filled].selectedFocusedCheckmarkColor = $CheckBox.icon.focusedBackground # hover @@ -152,8 +152,8 @@ ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) #---- Component ---- Component.borderColor = #c4c4c4 -Component.disabledBorderColor = #cfcfcf -Component.focusedBorderColor = #87afda +Component.disabledBorderColor = lighten($Component.borderColor,4%) +Component.focusedBorderColor = shade($Component.focusColor,10%) Component.focusColor = #97c3f3 Component.linkColor = #2470B3 Component.grayFilter = 25,-25,100 @@ -287,7 +287,7 @@ SplitPaneDivider.draggingColor = #c4c4c4 TabbedPane.underlineColor = #4083C9 TabbedPane.disabledUnderlineColor = #ababab TabbedPane.hoverColor = darken($TabbedPane.background,7%,derived) -TabbedPane.focusColor = #dae4ed +TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,10%) TabbedPane.contentAreaColor = #bfbfbf TabbedPane.buttonHoverBackground = darken($TabbedPane.background,7%,derived) diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties index 7ce6a467..6bd0de9d 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties @@ -33,7 +33,7 @@ UIColorHighlighter.stripingBackground = lighten(@textComponentBackground,5%) #---- Hyperlink ---- -Hyperlink.linkColor = #589df6 +Hyperlink.linkColor = $Component.linkColor Hyperlink.visitedColor = $Hyperlink.linkColor Hyperlink.disabledText = @disabledText diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties index fd81dfc8..4aadeef9 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties @@ -46,7 +46,7 @@ JXMonthView.monthStringForeground = @foreground JXMonthView.daysOfTheWeekForeground = #444 JXMonthView.weekOfTheYearForeground = #666 JXMonthView.unselectableDayForeground = #E02222 -JXMonthView.selectedBackground = #B9CEF8 +JXMonthView.selectedBackground = changeLightness(@selectionBackground,85%) JXMonthView.flaggedDayForeground = #E02222 JXMonthView.leadingDayForeground = @disabledText JXMonthView.trailingDayForeground = @disabledText diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt index 90eae36a..c0020f29 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt @@ -18,7 +18,7 @@ #---- CheckBox ---- -- CheckBox.icon.focusedBackground #466d944d 30% HSLA 210 36 43 30 javax.swing.plaf.ColorUIResource [UI] +- CheckBox.icon.focusedBackground #456e964d 30% HSLA 210 37 43 30 javax.swing.plaf.ColorUIResource [UI] #---- ComboBox ---- diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 2f401fdc..f3b0d567 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -64,31 +64,31 @@ BusyLabelUI com.formdev.flatlaf.swingx.ui.FlatBusyLabelUI Button.arc 6 Button.background #4c5052 HSL 200 4 31 javax.swing.plaf.ColorUIResource [UI] Button.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatButtonBorder [UI] -Button.borderColor #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +Button.borderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] Button.borderWidth 1 Button.darkShadow #7e7e7e HSL 0 0 49 javax.swing.plaf.ColorUIResource [UI] Button.default.background #365880 HSL 212 41 36 javax.swing.plaf.ColorUIResource [UI] Button.default.boldText true -Button.default.borderColor #4c708c HSL 206 30 42 javax.swing.plaf.ColorUIResource [UI] +Button.default.borderColor #547193 HSL 212 27 45 javax.swing.plaf.ColorUIResource [UI] Button.default.borderWidth 1 -Button.default.focusColor #43688c HSL 210 35 41 javax.swing.plaf.ColorUIResource [UI] -Button.default.focusedBorderColor #537699 HSL 210 30 46 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusColor #42698f HSL 210 37 41 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedBorderColor #5a7697 HSL 212 25 47 javax.swing.plaf.ColorUIResource [UI] Button.default.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Button.default.hoverBackground #3b5f8b HSL 213 40 39 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -Button.default.hoverBorderColor #537699 HSL 210 30 46 javax.swing.plaf.ColorUIResource [UI] +Button.default.hoverBorderColor #5a7697 HSL 212 25 47 javax.swing.plaf.ColorUIResource [UI] Button.default.pressedBackground #3f6796 HSL 212 41 42 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) Button.defaultButtonFollowsFocus false Button.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] -Button.disabledBorderColor #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +Button.disabledBorderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] Button.disabledForeground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Button.disabledSelectedBackground #53585a HSL 197 4 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) Button.disabledText #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] -Button.focusedBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +Button.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] Button.font [active] $defaultFont [UI] Button.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Button.highlight #242424 HSL 0 0 14 javax.swing.plaf.ColorUIResource [UI] Button.hoverBackground #53585a HSL 197 4 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -Button.hoverBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +Button.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] Button.iconTextGap 4 Button.innerFocusWidth 1 Button.light #313131 HSL 0 0 19 javax.swing.plaf.ColorUIResource [UI] @@ -128,10 +128,10 @@ CheckBox.icon.checkmarkColor #a7a7a7 HSL 0 0 65 javax.swing.plaf.Colo CheckBox.icon.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledBorderColor #545556 HSL 210 1 33 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledCheckmarkColor #606060 HSL 0 0 38 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBackground #466d944d 30% HSLA 210 36 43 30 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBackground #456e964d 30% HSLA 210 37 43 30 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.hoverBackground #4a5152 HSL 188 5 31 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -CheckBox.icon.hoverBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.pressedBackground #52595a HSL 188 5 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) CheckBox.icon.selectedBackground #43494a HSL 189 5 28 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.selectedBorderColor #6b6b6b HSL 0 0 42 javax.swing.plaf.ColorUIResource [UI] @@ -225,7 +225,7 @@ Component.error.borderColor #725555 HSL 0 15 39 javax.swing.plaf.Colo Component.error.focusedBorderColor #8b3c3c HSL 0 40 39 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #3d6185 HSL 210 37 38 javax.swing.plaf.ColorUIResource [UI] Component.focusWidth 0 -Component.focusedBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +Component.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter Component.hideMnemonics true Component.innerFocusWidth 0.5 @@ -333,9 +333,9 @@ HelpButton.borderWidth 1 HelpButton.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledBorderColor #545556 HSL 210 1 33 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledQuestionMarkColor #606060 HSL 0 0 38 javax.swing.plaf.ColorUIResource [UI] -HelpButton.focusedBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +HelpButton.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] HelpButton.hoverBackground #4a5152 HSL 188 5 31 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -HelpButton.hoverBorderColor #466d94 HSL 210 36 43 javax.swing.plaf.ColorUIResource [UI] +HelpButton.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] HelpButton.innerFocusWidth 1 HelpButton.pressedBackground #52595a HSL 188 5 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) @@ -436,7 +436,7 @@ JXMonthView.weekOfTheYearForeground #888888 HSL 0 0 53 javax.swing.plaf #---- JXTitledPanel ---- -JXTitledPanel.borderColor #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +JXTitledPanel.borderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] JXTitledPanel.captionInsets 4,10,4,10 javax.swing.plaf.InsetsUIResource [UI] JXTitledPanel.titleBackground #4c5052 HSL 200 4 31 javax.swing.plaf.ColorUIResource [UI] JXTitledPanel.titleForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] @@ -446,16 +446,16 @@ JXTitledPanel.titleForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo JideButton.background #4c5052 HSL 200 4 31 javax.swing.plaf.ColorUIResource [UI] JideButton.border [lazy] 0,0,0,0 false com.formdev.flatlaf.ui.FlatMarginBorder [UI] -JideButton.borderColor #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] -JideButton.darkShadow #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +JideButton.borderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] +JideButton.darkShadow #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] JideButton.focusedBackground #4e5355 HSL 197 4 32 com.formdev.flatlaf.util.DerivedColor [UI] lighten(1% autoInverse) JideButton.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] JideButton.highlight #656a6c HSL 197 3 41 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse) -JideButton.light #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +JideButton.light #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] JideButton.margin 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI] JideButton.selectedAndFocusedBackground #565a5d HSL 206 4 35 com.formdev.flatlaf.util.DerivedColor [UI] lighten(4% autoInverse) JideButton.selectedBackground #5d6265 HSL 203 4 38 com.formdev.flatlaf.util.DerivedColor [UI] lighten(7% autoInverse) -JideButton.shadow #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +JideButton.shadow #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] JideButton.textIconGap [active] 4 JideButtonUI com.formdev.flatlaf.jideoss.ui.FlatJideButtonUI @@ -531,7 +531,7 @@ List.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.Colo List.noFocusBorder 1,1,1,1 false javax.swing.plaf.BorderUIResource$EmptyBorderUIResource [UI] List.selectionBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI] List.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] -List.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI] +List.selectionInactiveBackground #0f2a3d HSL 205 61 15 javax.swing.plaf.ColorUIResource [UI] List.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] List.showCellFocusIndicator false List.timeFactor 1000 @@ -1017,7 +1017,7 @@ TabbedPane.darkShadow #7e7e7e HSL 0 0 49 javax.swing.plaf.Colo TabbedPane.disabledForeground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] TabbedPane.disabledUnderlineColor #7a7a7a HSL 0 0 48 javax.swing.plaf.ColorUIResource [UI] TabbedPane.focus #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] -TabbedPane.focusColor #3d4b5c HSL 213 20 30 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.focusColor #404b5d HSL 217 18 31 javax.swing.plaf.ColorUIResource [UI] TabbedPane.font [active] $defaultFont [UI] TabbedPane.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] TabbedPane.hasFullBorder false @@ -1075,7 +1075,7 @@ Table.rowHeight 20 Table.scrollPaneBorder [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatBorder [UI] Table.selectionBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI] Table.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] -Table.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI] +Table.selectionInactiveBackground #0f2a3d HSL 205 61 15 javax.swing.plaf.ColorUIResource [UI] Table.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Table.showHorizontalLines false Table.showVerticalLines false @@ -1104,7 +1104,7 @@ TableUI com.formdev.flatlaf.ui.FlatTableUI #---- TaskPane ---- TaskPane.background #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] -TaskPane.borderColor #5e6060 HSL 180 1 37 javax.swing.plaf.ColorUIResource [UI] +TaskPane.borderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] TaskPane.contentInsets 10,10,10,10 javax.swing.plaf.InsetsUIResource [UI] TaskPane.specialTitleBackground #afafaf HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] TaskPane.specialTitleForeground #222222 HSL 0 0 13 javax.swing.plaf.ColorUIResource [UI] @@ -1246,7 +1246,7 @@ ToggleButton.selectedBackground #656a6c HSL 197 3 41 com.formdev.flatlaf. ToggleButton.selectedForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] ToggleButton.shadow #646464 HSL 0 0 39 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.disabledUnderlineColor #7a7a7a HSL 0 0 48 javax.swing.plaf.ColorUIResource [UI] -ToggleButton.tab.focusBackground #3d4b5c HSL 213 20 30 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.tab.focusBackground #404b5d HSL 217 18 31 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.hoverBackground #303234 HSL 210 4 20 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%) ToggleButton.tab.underlineColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.underlineHeight 2 @@ -1344,7 +1344,7 @@ Tree.scrollsOnExpand true Tree.selectionBackground #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI] Tree.selectionBorderColor #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Tree.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] -Tree.selectionInactiveBackground #0d293e HSL 206 65 15 javax.swing.plaf.ColorUIResource [UI] +Tree.selectionInactiveBackground #0f2a3d HSL 205 61 15 javax.swing.plaf.ColorUIResource [UI] Tree.selectionInactiveForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Tree.showCellFocusIndicator false Tree.textBackground #45494a HSL 192 3 28 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt index 3b7d35be..e4358b5a 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt @@ -18,15 +18,15 @@ + Button.default.boldText true - Button.default.borderColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.borderColor #3d75b2 HSL 211 49 47 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.borderColor #4175ab HSL 211 45 46 javax.swing.plaf.ColorUIResource [UI] - Button.default.borderWidth 2 + Button.default.borderWidth 1 -- Button.default.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +- Button.default.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -- Button.default.focusedBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.focusedBorderColor #a9c9f5 HSL 215 79 81 javax.swing.plaf.ColorUIResource [UI] +- Button.default.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.focusedBorderColor #a6c5e4 HSL 210 53 77 javax.swing.plaf.ColorUIResource [UI] - Button.default.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] + Button.default.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] @@ -34,22 +34,22 @@ - Button.default.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) + Button.default.hoverBackground #4182c5 HSL 210 53 51 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -- Button.default.hoverBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.hoverBorderColor #a9c9f5 HSL 215 79 81 javax.swing.plaf.ColorUIResource [UI] +- Button.default.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.hoverBorderColor #a6c5e4 HSL 210 53 77 javax.swing.plaf.ColorUIResource [UI] - Button.default.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) + Button.default.pressedBackground #3571ae HSL 210 53 45 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) -- Button.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +- Button.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] #---- CheckBox ---- -- CheckBox.icon.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +- CheckBox.icon.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] + CheckBox.icon.style filled -- CheckBox.icon[filled].selectedFocusedCheckmarkColor #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +- CheckBox.icon[filled].selectedFocusedCheckmarkColor #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] #---- ComboBox ---- @@ -81,7 +81,7 @@ #---- HelpButton ---- -- HelpButton.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +- HelpButton.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] - HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] + HelpButton.icon [lazy] 26,26 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index d3942343..3aaa463b 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -71,25 +71,25 @@ Button.default.background #ffffff HSL 0 0 100 javax.swing.plaf.Colo Button.default.borderColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] Button.default.borderWidth 2 Button.default.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] -Button.default.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] -Button.default.focusedBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] Button.default.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Button.default.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -Button.default.hoverBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] +Button.default.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] Button.default.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) Button.defaultButtonFollowsFocus false Button.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] -Button.disabledBorderColor #cfcfcf HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] +Button.disabledBorderColor #cecece HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] Button.disabledForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] Button.disabledSelectedBackground #dedede HSL 0 0 87 com.formdev.flatlaf.util.DerivedColor [UI] darken(13% autoInverse) Button.disabledText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] -Button.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] -Button.focusedBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] +Button.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] +Button.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] Button.font [active] $defaultFont [UI] Button.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Button.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Button.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -Button.hoverBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] +Button.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] Button.iconTextGap 4 Button.innerFocusWidth 0 Button.light #e3e3e3 HSL 0 0 89 javax.swing.plaf.ColorUIResource [UI] @@ -129,10 +129,10 @@ CheckBox.icon.checkmarkColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.Colo CheckBox.icon.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledBorderColor #bdbdbd HSL 0 0 74 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledCheckmarkColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBorderColor #7b9fc7 HSL 212 40 63 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -CheckBox.icon.hoverBorderColor #7b9fc7 HSL 212 40 63 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.hoverBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) CheckBox.icon.selectedBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.selectedBorderColor #b0b0b0 HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] @@ -140,10 +140,10 @@ CheckBox.icon [lazy] 15,15 com.formdev.flatlaf.icons.FlatChe CheckBox.iconTextGap 4 CheckBox.icon[filled].checkmarkColor #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon[filled].selectedBackground #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedBorderColor #4b97d9 HSL 208 65 57 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedBorderColor #4b96d8 HSL 208 64 57 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon[filled].selectedFocusedBackground #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedFocusedBorderColor #accff7 HSL 212 82 82 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedFocusedCheckmarkColor #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedFocusedBorderColor #a7cff1 HSL 208 73 80 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedFocusedCheckmarkColor #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon[filled].selectedHoverBackground #3992e0 HSL 208 73 55 com.formdev.flatlaf.util.DerivedColor [UI] darken(5% autoInverse) CheckBox.icon[filled].selectedPressedBackground #2386dc HSL 208 73 50 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) CheckBox.margin 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI] @@ -224,12 +224,12 @@ Component.arc 5 Component.arrowType chevron Component.borderColor #c4c4c4 HSL 0 0 77 javax.swing.plaf.ColorUIResource [UI] Component.custom.borderColor #f38d8d HSL 0 81 75 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%) -Component.disabledBorderColor #cfcfcf HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] +Component.disabledBorderColor #cecece HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] Component.error.borderColor #ebb8bc HSL 355 56 82 javax.swing.plaf.ColorUIResource [UI] Component.error.focusedBorderColor #e53e4d HSL 355 76 57 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] Component.focusWidth 0 -Component.focusedBorderColor #87afda HSL 211 53 69 javax.swing.plaf.ColorUIResource [UI] +Component.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter Component.hideMnemonics true Component.innerFocusWidth 0.5 @@ -337,10 +337,10 @@ HelpButton.borderWidth 1 HelpButton.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledBorderColor #bdbdbd HSL 0 0 74 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledQuestionMarkColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] -HelpButton.focusedBackground #e3f1fa HSL 203 70 94 javax.swing.plaf.ColorUIResource [UI] -HelpButton.focusedBorderColor #7b9fc7 HSL 212 40 63 javax.swing.plaf.ColorUIResource [UI] +HelpButton.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] +HelpButton.focusedBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] HelpButton.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -HelpButton.hoverBorderColor #7b9fc7 HSL 212 40 63 javax.swing.plaf.ColorUIResource [UI] +HelpButton.hoverBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] HelpButton.innerFocusWidth 0 HelpButton.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) @@ -433,7 +433,7 @@ JXMonthView.monthDownFileName [lazy] 20,20 com.formdev.flatlaf.swingx.ui.Fla JXMonthView.monthStringBackground #dfdfdf HSL 0 0 87 javax.swing.plaf.ColorUIResource [UI] JXMonthView.monthStringForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] JXMonthView.monthUpFileName [lazy] 20,20 com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon [UI] -JXMonthView.selectedBackground #b9cef8 HSL 220 82 85 javax.swing.plaf.ColorUIResource [UI] +JXMonthView.selectedBackground #bfdaf2 HSL 208 66 85 javax.swing.plaf.ColorUIResource [UI] JXMonthView.trailingDayForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] JXMonthView.unselectableDayForeground #e02222 HSL 0 75 51 javax.swing.plaf.ColorUIResource [UI] JXMonthView.weekOfTheYearForeground #666666 HSL 0 0 40 javax.swing.plaf.ColorUIResource [UI] @@ -1022,7 +1022,7 @@ TabbedPane.darkShadow #9e9e9e HSL 0 0 62 javax.swing.plaf.Colo TabbedPane.disabledForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] TabbedPane.disabledUnderlineColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] TabbedPane.focus #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] -TabbedPane.focusColor #dae4ed HSL 208 35 89 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.focusColor #dee6ed HSL 208 29 90 javax.swing.plaf.ColorUIResource [UI] TabbedPane.font [active] $defaultFont [UI] TabbedPane.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] TabbedPane.hasFullBorder false @@ -1251,7 +1251,7 @@ ToggleButton.selectedBackground #cccccc HSL 0 0 80 com.formdev.flatlaf. ToggleButton.selectedForeground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] ToggleButton.shadow #c4c4c4 HSL 0 0 77 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.disabledUnderlineColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] -ToggleButton.tab.focusBackground #dae4ed HSL 208 35 89 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.tab.focusBackground #dee6ed HSL 208 29 90 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.hoverBackground #e0e0e0 HSL 0 0 88 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse) ToggleButton.tab.underlineColor #4083c9 HSL 211 56 52 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.underlineHeight 2 From 9144b7206ef9bbf93db06ef6b675c81e7c5d443e Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Fri, 6 Aug 2021 22:52:23 +0200 Subject: [PATCH 02/12] Accent color: - added @accentXYZ variables that define all blueish accent colors - all blueish accent colors are calculated based on @accentColor (issue #233) --- .../formdev/flatlaf/FlatDarkLaf.properties | 23 +++++-- .../flatlaf/FlatIntelliJLaf.properties | 7 +- .../formdev/flatlaf/FlatLightLaf.properties | 31 +++++---- .../uidefaults/FlatDarculaLaf_1.8.0_202.txt | 4 +- .../uidefaults/FlatDarkLaf_1.8.0_202.txt | 56 ++++++++-------- .../uidefaults/FlatIntelliJLaf_1.8.0_202.txt | 18 ++--- .../uidefaults/FlatLightLaf_1.8.0_202.txt | 66 +++++++++---------- 7 files changed, 114 insertions(+), 91 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index edd17490..4c554b12 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -34,7 +34,7 @@ @background = #3c3f41 @foreground = #bbb -@selectionBackground = #4B6EAF +@selectionBackground = @accentSelectionBackground @selectionForeground = @foreground @selectionInactiveBackground =spin(saturate(shade(@selectionBackground,70%),20%),-15) @selectionInactiveForeground = @foreground @@ -48,6 +48,15 @@ @cellFocusColor = #000 @icon = #adadad +# accent colors (blueish) +@accentColor = #4B6EAF +@accentFocusColor = shade(spin(@accentColor,-8),20%) +@accentLinkColor = lighten(saturate(spin(@accentColor,-5),50%),16%) +@accentSelectionBackground = @accentColor +@accentSliderColor = @accentUnderlineColor +@accentUnderlineColor = lighten(saturate(spin(@accentColor,-8),13%),5%) +@accentButtonDefaultBackground = darken(spin(@accentColor,-8),13%) + # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #9A9DA1 @buttonDisabledArrowColor = darken(@buttonArrowColor,25%) @@ -86,7 +95,7 @@ Button.hoverBorderColor = $Button.focusedBorderColor Button.innerFocusWidth = 1 -Button.default.background = #365880 +Button.default.background = @accentButtonDefaultBackground Button.default.foreground = @foreground Button.default.hoverBackground = lighten($Button.default.background,3%,derived) Button.default.pressedBackground = lighten($Button.default.background,6%,derived) @@ -148,8 +157,8 @@ ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) Component.borderColor = #646464 Component.disabledBorderColor = $Component.borderColor Component.focusedBorderColor = lighten($Component.focusColor,5%) -Component.focusColor = #3d6185 -Component.linkColor = #589df6 +Component.focusColor = @accentFocusColor +Component.linkColor = @accentLinkColor Component.grayFilter = -20,-70,100 Component.error.borderColor = desaturate($Component.error.focusedBorderColor,25%) @@ -226,7 +235,7 @@ PopupMenu.borderColor = #5e5e5e #---- ProgressBar ---- ProgressBar.background = #555 -ProgressBar.foreground = #4A88C7 +ProgressBar.foreground = @accentSliderColor ProgressBar.selectionForeground = @foreground ProgressBar.selectionBackground = @foreground @@ -255,7 +264,7 @@ Separator.foreground = #515151 #---- Slider ---- -Slider.trackValueColor = #4A88C7 +Slider.trackValueColor = @accentSliderColor Slider.trackColor = #646464 Slider.thumbColor = $Slider.trackValueColor Slider.tickColor = #888 @@ -273,7 +282,7 @@ SplitPaneDivider.draggingColor = #646464 #---- TabbedPane ---- -TabbedPane.underlineColor = #4A88C7 +TabbedPane.underlineColor = @accentUnderlineColor TabbedPane.disabledUnderlineColor = #7a7a7a TabbedPane.hoverColor = darken($TabbedPane.background,5%,derived noAutoInverse) TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,25%) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index e3cd5d67..918023b3 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -31,11 +31,16 @@ # which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o. # See: https://github.com/JetBrains/intellij-community/ +#---- variables ---- + +# accent colors (blueish) +@accentButtonDefaultBackground = tint(@accentColor,15%) + #---- Button ---- Button.focusedBackground = null -Button.default.background = #4D8AC9 +Button.default.background = @accentButtonDefaultBackground Button.default.foreground = #fff Button.default.focusedBackground = null Button.default.borderColor = shade($Button.default.background,15%) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index fa21ede5..f28cd663 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -34,7 +34,7 @@ @background = #f2f2f2 @foreground = #000 -@selectionBackground = #2675BF +@selectionBackground = @accentSelectionBackground @selectionForeground = #fff @selectionInactiveBackground = #d4d4d4 @selectionInactiveForeground = @foreground @@ -48,6 +48,15 @@ @cellFocusColor = #000 @icon = #afafaf +# accent colors (blueish) +@accentColor = #2675BF +@accentCheckmarkColor = tint(@accentSliderColor,20%) +@accentFocusColor = lighten(@accentColor,31%) +@accentLinkColor = darken(@accentColor,3%) +@accentSelectionBackground = @accentColor +@accentSliderColor = lighten(saturate(@accentColor,10%),6%) +@accentUnderlineColor = tint(@accentColor,10%) + # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #666 @buttonDisabledArrowColor = lighten(@buttonArrowColor,25%) @@ -92,7 +101,7 @@ Button.default.foreground = @foreground Button.default.focusedBackground = $Button.focusedBackground Button.default.hoverBackground = darken($Button.default.background,3%,derived) Button.default.pressedBackground = darken($Button.default.background,10%,derived) -Button.default.borderColor = #4F9EE3 +Button.default.borderColor = @accentCheckmarkColor Button.default.hoverBorderColor = $Button.hoverBorderColor Button.default.focusedBorderColor = $Button.focusedBorderColor Button.default.focusColor = $Component.focusColor @@ -110,7 +119,7 @@ CheckBox.icon.borderColor = #b0b0b0 CheckBox.icon.background = #fff CheckBox.icon.selectedBorderColor = $CheckBox.icon.borderColor CheckBox.icon.selectedBackground = $CheckBox.icon.background -CheckBox.icon.checkmarkColor = #4F9EE3 +CheckBox.icon.checkmarkColor = @accentCheckmarkColor # disabled CheckBox.icon.disabledBorderColor = #BDBDBD @@ -132,7 +141,7 @@ CheckBox.icon.pressedBackground = $Button.pressedBackground # used if CheckBox.icon.style = filled # enabled CheckBox.icon[filled].selectedBorderColor = shade($CheckBox.icon[filled].selectedBackground,5%) -CheckBox.icon[filled].selectedBackground = #4F9EE3 +CheckBox.icon[filled].selectedBackground = @accentCheckmarkColor CheckBox.icon[filled].checkmarkColor = #fff # focused CheckBox.icon[filled].selectedFocusedBorderColor = tint($CheckBox.icon[filled].selectedBackground,50%) @@ -154,8 +163,8 @@ ComboBox.buttonEditableBackground = darken($ComboBox.background,2%) Component.borderColor = #c4c4c4 Component.disabledBorderColor = lighten($Component.borderColor,4%) Component.focusedBorderColor = shade($Component.focusColor,10%) -Component.focusColor = #97c3f3 -Component.linkColor = #2470B3 +Component.focusColor = @accentFocusColor +Component.linkColor = @accentLinkColor Component.grayFilter = 25,-25,100 Component.error.borderColor = lighten(desaturate($Component.error.focusedBorderColor,20%),25%) @@ -177,7 +186,7 @@ DesktopIcon.background = darken($Desktop.background,10%,derived) #---- HelpButton ---- -HelpButton.questionMarkColor = #4F9EE3 +HelpButton.questionMarkColor = @accentCheckmarkColor #---- InternalFrame ---- @@ -214,7 +223,7 @@ MenuBar.borderColor = #cdcdcd #---- MenuItemCheckBox ---- -MenuItemCheckBox.icon.checkmarkColor = #4F9EE3 +MenuItemCheckBox.icon.checkmarkColor = @accentCheckmarkColor MenuItemCheckBox.icon.disabledCheckmarkColor = #ABABAB @@ -237,7 +246,7 @@ PopupMenu.borderColor = #adadad #---- ProgressBar ---- ProgressBar.background = #D1D1D1 -ProgressBar.foreground = #1E82E6 +ProgressBar.foreground = @accentSliderColor ProgressBar.selectionForeground = @textComponentBackground ProgressBar.selectionBackground = @foreground @@ -266,7 +275,7 @@ Separator.foreground = #d1d1d1 #---- Slider ---- -Slider.trackValueColor = #1E82E6 +Slider.trackValueColor = @accentSliderColor Slider.trackColor = #c4c4c4 Slider.thumbColor = $Slider.trackValueColor Slider.tickColor = #888 @@ -284,7 +293,7 @@ SplitPaneDivider.draggingColor = #c4c4c4 #---- TabbedPane ---- -TabbedPane.underlineColor = #4083C9 +TabbedPane.underlineColor = @accentUnderlineColor TabbedPane.disabledUnderlineColor = #ababab TabbedPane.hoverColor = darken($TabbedPane.background,7%,derived) TabbedPane.focusColor = mix(@selectionBackground,$TabbedPane.background,10%) diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt index c0020f29..c1df2ed7 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarculaLaf_1.8.0_202.txt @@ -18,7 +18,7 @@ #---- CheckBox ---- -- CheckBox.icon.focusedBackground #456e964d 30% HSLA 210 37 43 30 javax.swing.plaf.ColorUIResource [UI] +- CheckBox.icon.focusedBackground #446e9e4d 30% HSLA 212 40 44 30 javax.swing.plaf.ColorUIResource [UI] #---- ComboBox ---- @@ -71,7 +71,7 @@ #---- ProgressBar ---- -- ProgressBar.foreground #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +- ProgressBar.foreground #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] + ProgressBar.foreground #a0a0a0 HSL 0 0 63 javax.swing.plaf.ColorUIResource [UI] - ProgressBar.selectionForeground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index f3b0d567..84f7ac67 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -67,28 +67,28 @@ Button.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.F Button.borderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] Button.borderWidth 1 Button.darkShadow #7e7e7e HSL 0 0 49 javax.swing.plaf.ColorUIResource [UI] -Button.default.background #365880 HSL 212 41 36 javax.swing.plaf.ColorUIResource [UI] +Button.default.background #375a81 HSL 212 40 36 javax.swing.plaf.ColorUIResource [UI] Button.default.boldText true -Button.default.borderColor #547193 HSL 212 27 45 javax.swing.plaf.ColorUIResource [UI] +Button.default.borderColor #557394 HSL 211 27 46 javax.swing.plaf.ColorUIResource [UI] Button.default.borderWidth 1 -Button.default.focusColor #42698f HSL 210 37 41 javax.swing.plaf.ColorUIResource [UI] -Button.default.focusedBorderColor #5a7697 HSL 212 25 47 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusColor #416997 HSL 212 40 42 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedBorderColor #5b7898 HSL 211 25 48 javax.swing.plaf.ColorUIResource [UI] Button.default.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] -Button.default.hoverBackground #3b5f8b HSL 213 40 39 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -Button.default.hoverBorderColor #5a7697 HSL 212 25 47 javax.swing.plaf.ColorUIResource [UI] -Button.default.pressedBackground #3f6796 HSL 212 41 42 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) +Button.default.hoverBackground #3c618c HSL 212 40 39 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) +Button.default.hoverBorderColor #5b7898 HSL 211 25 48 javax.swing.plaf.ColorUIResource [UI] +Button.default.pressedBackground #406996 HSL 211 40 42 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) Button.defaultButtonFollowsFocus false Button.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] Button.disabledBorderColor #5e6263 HSL 192 3 38 javax.swing.plaf.ColorUIResource [UI] Button.disabledForeground #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Button.disabledSelectedBackground #53585a HSL 197 4 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) Button.disabledText #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] -Button.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +Button.focusedBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] Button.font [active] $defaultFont [UI] Button.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Button.highlight #242424 HSL 0 0 14 javax.swing.plaf.ColorUIResource [UI] Button.hoverBackground #53585a HSL 197 4 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -Button.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +Button.hoverBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] Button.iconTextGap 4 Button.innerFocusWidth 1 Button.light #313131 HSL 0 0 19 javax.swing.plaf.ColorUIResource [UI] @@ -128,10 +128,10 @@ CheckBox.icon.checkmarkColor #a7a7a7 HSL 0 0 65 javax.swing.plaf.Colo CheckBox.icon.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledBorderColor #545556 HSL 210 1 33 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledCheckmarkColor #606060 HSL 0 0 38 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBackground #456e964d 30% HSLA 210 37 43 30 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBackground #446e9e4d 30% HSLA 212 40 44 30 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.hoverBackground #4a5152 HSL 188 5 31 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -CheckBox.icon.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.hoverBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.pressedBackground #52595a HSL 188 5 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) CheckBox.icon.selectedBackground #43494a HSL 189 5 28 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.selectedBorderColor #6b6b6b HSL 0 0 42 javax.swing.plaf.ColorUIResource [UI] @@ -223,14 +223,14 @@ Component.custom.borderColor #bf4040 HSL 0 50 50 com.formdev.flatlaf.u Component.disabledBorderColor #646464 HSL 0 0 39 javax.swing.plaf.ColorUIResource [UI] Component.error.borderColor #725555 HSL 0 15 39 javax.swing.plaf.ColorUIResource [UI] Component.error.focusedBorderColor #8b3c3c HSL 0 40 39 javax.swing.plaf.ColorUIResource [UI] -Component.focusColor #3d6185 HSL 210 37 38 javax.swing.plaf.ColorUIResource [UI] +Component.focusColor #3c628c HSL 212 40 39 javax.swing.plaf.ColorUIResource [UI] Component.focusWidth 0 -Component.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +Component.focusedBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter Component.hideMnemonics true Component.innerFocusWidth 0.5 Component.innerOutlineWidth 1.0 -Component.linkColor #589df6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] +Component.linkColor #579bf6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] Component.minimumWidth 64 Component.warning.borderColor #725627 HSL 38 49 30 javax.swing.plaf.ColorUIResource [UI] Component.warning.focusedBorderColor #ac7920 HSL 38 69 40 javax.swing.plaf.ColorUIResource [UI] @@ -333,9 +333,9 @@ HelpButton.borderWidth 1 HelpButton.disabledBackground #3c3f41 HSL 204 4 25 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledBorderColor #545556 HSL 210 1 33 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledQuestionMarkColor #606060 HSL 0 0 38 javax.swing.plaf.ColorUIResource [UI] -HelpButton.focusedBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +HelpButton.focusedBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] HelpButton.hoverBackground #4a5152 HSL 188 5 31 com.formdev.flatlaf.util.DerivedColor [UI] lighten(3% autoInverse) -HelpButton.hoverBorderColor #456e96 HSL 210 37 43 javax.swing.plaf.ColorUIResource [UI] +HelpButton.hoverBorderColor #446e9e HSL 212 40 44 javax.swing.plaf.ColorUIResource [UI] HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] HelpButton.innerFocusWidth 1 HelpButton.pressedBackground #52595a HSL 188 5 34 com.formdev.flatlaf.util.DerivedColor [UI] lighten(6% autoInverse) @@ -345,8 +345,8 @@ HelpButton.questionMarkColor #a7a7a7 HSL 0 0 65 javax.swing.plaf.Colo #---- Hyperlink ---- Hyperlink.disabledText #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] -Hyperlink.linkColor #589df6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] -Hyperlink.visitedColor #589df6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] +Hyperlink.linkColor #579bf6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] +Hyperlink.visitedColor #579bf6 HSL 214 90 65 javax.swing.plaf.ColorUIResource [UI] HyperlinkUI com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI @@ -611,7 +611,7 @@ MenuItem.textAcceleratorGap 24 MenuItem.textNoAcceleratorGap 6 MenuItem.underlineSelectionBackground #484c4f HSL 206 5 30 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse) MenuItem.underlineSelectionCheckBackground #3c588b HSL 219 40 39 com.formdev.flatlaf.util.DerivedColor [UI] darken(10%) -MenuItem.underlineSelectionColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +MenuItem.underlineSelectionColor #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] MenuItem.underlineSelectionHeight 3 @@ -750,7 +750,7 @@ ProgressBar.cellLength 1 ProgressBar.cellSpacing 0 ProgressBar.cycleTime 4000 ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] -ProgressBar.foreground #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +ProgressBar.foreground #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] ProgressBar.horizontalSize 146,4 javax.swing.plaf.DimensionUIResource [UI] ProgressBar.repaintInterval 15 ProgressBar.selectionBackground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] @@ -918,22 +918,22 @@ Slider.disabledTrackColor #4c5052 HSL 200 4 31 javax.swing.plaf.Colo Slider.focus #7e7e7e HSL 0 0 49 javax.swing.plaf.ColorUIResource [UI] Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] Slider.focusWidth 4 -Slider.focusedColor #3d6185b3 70% HSLA 210 37 38 70 com.formdev.flatlaf.util.DerivedColor [UI] fade(70%) +Slider.focusedColor #3c628cb3 70% HSLA 212 40 39 70 com.formdev.flatlaf.util.DerivedColor [UI] fade(70%) Slider.font [active] $defaultFont [UI] Slider.foreground #bbbbbb HSL 0 0 73 javax.swing.plaf.ColorUIResource [UI] Slider.highlight #242424 HSL 0 0 14 javax.swing.plaf.ColorUIResource [UI] Slider.horizontalSize 200,21 java.awt.Dimension -Slider.hoverThumbColor #5d95cd HSL 210 53 58 com.formdev.flatlaf.util.DerivedColor [UI] lighten(5% autoInverse) +Slider.hoverThumbColor #6094ce HSL 212 53 59 com.formdev.flatlaf.util.DerivedColor [UI] lighten(5% autoInverse) Slider.minimumHorizontalSize 36,21 java.awt.Dimension Slider.minimumVerticalSize 21,36 java.awt.Dimension Slider.onlyLeftMouseButtonDrag true -Slider.pressedThumbColor #699cd1 HSL 211 53 62 com.formdev.flatlaf.util.DerivedColor [UI] lighten(8% autoInverse) +Slider.pressedThumbColor #6b9cd2 HSL 211 53 62 com.formdev.flatlaf.util.DerivedColor [UI] lighten(8% autoInverse) Slider.shadow #646464 HSL 0 0 39 javax.swing.plaf.ColorUIResource [UI] -Slider.thumbColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +Slider.thumbColor #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] Slider.thumbSize 12,12 javax.swing.plaf.DimensionUIResource [UI] Slider.tickColor #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Slider.trackColor #646464 HSL 0 0 39 javax.swing.plaf.ColorUIResource [UI] -Slider.trackValueColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +Slider.trackValueColor #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] Slider.trackWidth 2 Slider.verticalSize 21,200 java.awt.Dimension SliderUI com.formdev.flatlaf.ui.FlatSliderUI @@ -1046,7 +1046,7 @@ TabbedPane.tabsOpaque true TabbedPane.tabsOverlapBorder false TabbedPane.tabsPopupPolicy asNeeded TabbedPane.textIconGap 4 -TabbedPane.underlineColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.underlineColor #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] TabbedPaneUI com.formdev.flatlaf.ui.FlatTabbedPaneUI @@ -1248,7 +1248,7 @@ ToggleButton.shadow #646464 HSL 0 0 39 javax.swing.plaf.Colo ToggleButton.tab.disabledUnderlineColor #7a7a7a HSL 0 0 48 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.focusBackground #404b5d HSL 217 18 31 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.hoverBackground #303234 HSL 210 4 20 com.formdev.flatlaf.util.DerivedColor [UI] darken(5%) -ToggleButton.tab.underlineColor #4a88c7 HSL 210 53 54 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.tab.underlineColor #4c87c8 HSL 211 53 54 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.underlineHeight 2 ToggleButton.textIconGap 4 ToggleButton.textShiftOffset 0 diff --git a/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt index e4358b5a..d6580222 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatIntelliJLaf_1.8.0_202.txt @@ -13,32 +13,32 @@ + Button.border [lazy] 3,3,3,3 false com.formdev.flatlaf.ui.FlatButtonBorder [UI] - Button.default.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.background #4d8ac9 HSL 210 53 55 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.background #478ac9 HSL 209 55 53 javax.swing.plaf.ColorUIResource [UI] + Button.default.boldText true -- Button.default.borderColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.borderColor #4175ab HSL 211 45 46 javax.swing.plaf.ColorUIResource [UI] +- Button.default.borderColor #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.borderColor #3c75ab HSL 209 48 45 javax.swing.plaf.ColorUIResource [UI] - Button.default.borderWidth 2 + Button.default.borderWidth 1 - Button.default.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -- Button.default.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.focusedBorderColor #a6c5e4 HSL 210 53 77 javax.swing.plaf.ColorUIResource [UI] +- Button.default.focusedBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.focusedBorderColor #a3c5e4 HSL 209 55 77 javax.swing.plaf.ColorUIResource [UI] - Button.default.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] + Button.default.foreground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] - Button.default.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -+ Button.default.hoverBackground #4182c5 HSL 210 53 51 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) ++ Button.default.hoverBackground #3b82c6 HSL 209 55 50 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -- Button.default.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] -+ Button.default.hoverBorderColor #a6c5e4 HSL 210 53 77 javax.swing.plaf.ColorUIResource [UI] +- Button.default.hoverBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] ++ Button.default.hoverBorderColor #a3c5e4 HSL 209 55 77 javax.swing.plaf.ColorUIResource [UI] - Button.default.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) -+ Button.default.pressedBackground #3571ae HSL 210 53 45 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) ++ Button.default.pressedBackground #3270ab HSL 209 55 43 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) - Button.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index 3aaa463b..b4a7720e 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -68,14 +68,14 @@ Button.borderColor #c4c4c4 HSL 0 0 77 javax.swing.plaf.Colo Button.borderWidth 1 Button.darkShadow #9e9e9e HSL 0 0 62 javax.swing.plaf.ColorUIResource [UI] Button.default.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] -Button.default.borderColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] +Button.default.borderColor #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] Button.default.borderWidth 2 -Button.default.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusColor #98c3eb HSL 209 67 76 javax.swing.plaf.ColorUIResource [UI] Button.default.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -Button.default.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] +Button.default.focusedBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] Button.default.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Button.default.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -Button.default.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] +Button.default.hoverBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] Button.default.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) Button.defaultButtonFollowsFocus false Button.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] @@ -84,12 +84,12 @@ Button.disabledForeground #8c8c8c HSL 0 0 55 javax.swing.plaf.Colo Button.disabledSelectedBackground #dedede HSL 0 0 87 com.formdev.flatlaf.util.DerivedColor [UI] darken(13% autoInverse) Button.disabledText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] Button.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -Button.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] +Button.focusedBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] Button.font [active] $defaultFont [UI] Button.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Button.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Button.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -Button.hoverBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] +Button.hoverBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] Button.iconTextGap 4 Button.innerFocusWidth 0 Button.light #e3e3e3 HSL 0 0 89 javax.swing.plaf.ColorUIResource [UI] @@ -125,27 +125,27 @@ CheckBox.font [active] $defaultFont [UI] CheckBox.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.borderColor #b0b0b0 HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.checkmarkColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.checkmarkColor #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledBorderColor #bdbdbd HSL 0 0 74 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.disabledCheckmarkColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon.focusedBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.focusedBorderColor #7b9ebf HSL 209 35 62 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -CheckBox.icon.hoverBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon.hoverBorderColor #7b9ebf HSL 209 35 62 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) CheckBox.icon.selectedBackground #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon.selectedBorderColor #b0b0b0 HSL 0 0 69 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon [lazy] 15,15 com.formdev.flatlaf.icons.FlatCheckBoxIcon [UI] CheckBox.iconTextGap 4 CheckBox.icon[filled].checkmarkColor #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedBackground #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedBorderColor #4b96d8 HSL 208 64 57 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedFocusedBackground #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedFocusedBorderColor #a7cff1 HSL 208 73 80 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedBackground #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedBorderColor #4a95db HSL 209 67 57 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedFocusedBackground #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] +CheckBox.icon[filled].selectedFocusedBorderColor #a7cef3 HSL 209 76 80 javax.swing.plaf.ColorUIResource [UI] CheckBox.icon[filled].selectedFocusedCheckmarkColor #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -CheckBox.icon[filled].selectedHoverBackground #3992e0 HSL 208 73 55 com.formdev.flatlaf.util.DerivedColor [UI] darken(5% autoInverse) -CheckBox.icon[filled].selectedPressedBackground #2386dc HSL 208 73 50 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) +CheckBox.icon[filled].selectedHoverBackground #3891e4 HSL 209 76 56 com.formdev.flatlaf.util.DerivedColor [UI] darken(5% autoInverse) +CheckBox.icon[filled].selectedPressedBackground #2184e1 HSL 209 76 51 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) CheckBox.margin 2,2,2,2 javax.swing.plaf.InsetsUIResource [UI] CheckBox.rollover true CheckBox.textIconGap 4 @@ -227,14 +227,14 @@ Component.custom.borderColor #f38d8d HSL 0 81 75 com.formdev.flatlaf.u Component.disabledBorderColor #cecece HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] Component.error.borderColor #ebb8bc HSL 355 56 82 javax.swing.plaf.ColorUIResource [UI] Component.error.focusedBorderColor #e53e4d HSL 355 76 57 javax.swing.plaf.ColorUIResource [UI] -Component.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] +Component.focusColor #98c3eb HSL 209 67 76 javax.swing.plaf.ColorUIResource [UI] Component.focusWidth 0 -Component.focusedBorderColor #88b0db HSL 211 54 70 javax.swing.plaf.ColorUIResource [UI] +Component.focusedBorderColor #89b0d4 HSL 209 47 68 javax.swing.plaf.ColorUIResource [UI] Component.grayFilter [lazy] [unknown type] com.formdev.flatlaf.util.GrayFilter Component.hideMnemonics true Component.innerFocusWidth 0.5 Component.innerOutlineWidth 1.0 -Component.linkColor #2470b3 HSL 208 67 42 javax.swing.plaf.ColorUIResource [UI] +Component.linkColor #236db2 HSL 209 67 42 javax.swing.plaf.ColorUIResource [UI] Component.minimumWidth 64 Component.warning.borderColor #fed284 HSL 38 98 76 javax.swing.plaf.ColorUIResource [UI] Component.warning.focusedBorderColor #e2a53a HSL 38 74 56 javax.swing.plaf.ColorUIResource [UI] @@ -338,20 +338,20 @@ HelpButton.disabledBackground #f2f2f2 HSL 0 0 95 javax.swing.plaf.Colo HelpButton.disabledBorderColor #bdbdbd HSL 0 0 74 javax.swing.plaf.ColorUIResource [UI] HelpButton.disabledQuestionMarkColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] HelpButton.focusedBackground #eaf3fb HSL 208 68 95 javax.swing.plaf.ColorUIResource [UI] -HelpButton.focusedBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] +HelpButton.focusedBorderColor #7b9ebf HSL 209 35 62 javax.swing.plaf.ColorUIResource [UI] HelpButton.hoverBackground #f7f7f7 HSL 0 0 97 com.formdev.flatlaf.util.DerivedColor [UI] darken(3% autoInverse) -HelpButton.hoverBorderColor #7a9ec5 HSL 211 39 63 javax.swing.plaf.ColorUIResource [UI] +HelpButton.hoverBorderColor #7b9ebf HSL 209 35 62 javax.swing.plaf.ColorUIResource [UI] HelpButton.icon [lazy] 22,22 com.formdev.flatlaf.icons.FlatHelpButtonIcon [UI] HelpButton.innerFocusWidth 0 HelpButton.pressedBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) -HelpButton.questionMarkColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] +HelpButton.questionMarkColor #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] #---- Hyperlink ---- Hyperlink.disabledText #8c8c8c HSL 0 0 55 javax.swing.plaf.ColorUIResource [UI] -Hyperlink.linkColor #2470b3 HSL 208 67 42 javax.swing.plaf.ColorUIResource [UI] -Hyperlink.visitedColor #2470b3 HSL 208 67 42 javax.swing.plaf.ColorUIResource [UI] +Hyperlink.linkColor #236db2 HSL 209 67 42 javax.swing.plaf.ColorUIResource [UI] +Hyperlink.visitedColor #236db2 HSL 209 67 42 javax.swing.plaf.ColorUIResource [UI] HyperlinkUI com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI @@ -616,13 +616,13 @@ MenuItem.textAcceleratorGap 24 MenuItem.textNoAcceleratorGap 6 MenuItem.underlineSelectionBackground #e6e6e6 HSL 0 0 90 com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse) MenuItem.underlineSelectionCheckBackground #bfd9f2 HSL 209 66 85 com.formdev.flatlaf.util.DerivedColor [UI] lighten(40%) -MenuItem.underlineSelectionColor #4083c9 HSL 211 56 52 javax.swing.plaf.ColorUIResource [UI] +MenuItem.underlineSelectionColor #3c83c5 HSL 209 54 50 javax.swing.plaf.ColorUIResource [UI] MenuItem.underlineSelectionHeight 3 #---- MenuItemCheckBox ---- -MenuItemCheckBox.icon.checkmarkColor #4f9ee3 HSL 208 73 60 javax.swing.plaf.ColorUIResource [UI] +MenuItemCheckBox.icon.checkmarkColor #4e9de7 HSL 209 76 61 javax.swing.plaf.ColorUIResource [UI] MenuItemCheckBox.icon.disabledCheckmarkColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] @@ -755,7 +755,7 @@ ProgressBar.cellLength 1 ProgressBar.cellSpacing 0 ProgressBar.cycleTime 4000 ProgressBar.font [active] Segoe UI plain 10 javax.swing.plaf.FontUIResource [UI] -ProgressBar.foreground #1e82e6 HSL 210 80 51 javax.swing.plaf.ColorUIResource [UI] +ProgressBar.foreground #2285e1 HSL 209 76 51 javax.swing.plaf.ColorUIResource [UI] ProgressBar.horizontalSize 146,4 javax.swing.plaf.DimensionUIResource [UI] ProgressBar.repaintInterval 15 ProgressBar.selectionBackground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] @@ -923,22 +923,22 @@ Slider.disabledTrackColor #c0c0c0 HSL 0 0 75 javax.swing.plaf.Colo Slider.focus #9e9e9e HSL 0 0 62 javax.swing.plaf.ColorUIResource [UI] Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] Slider.focusWidth 4 -Slider.focusedColor #97c3f380 50% HSLA 211 79 77 50 com.formdev.flatlaf.util.DerivedColor [UI] fade(50%) +Slider.focusedColor #98c3eb80 50% HSLA 209 67 76 50 com.formdev.flatlaf.util.DerivedColor [UI] fade(50%) Slider.font [active] $defaultFont [UI] Slider.foreground #000000 HSL 0 0 0 javax.swing.plaf.ColorUIResource [UI] Slider.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Slider.horizontalSize 200,21 java.awt.Dimension -Slider.hoverThumbColor #1775d3 HSL 210 80 46 com.formdev.flatlaf.util.DerivedColor [UI] darken(5% autoInverse) +Slider.hoverThumbColor #1c78ce HSL 209 76 46 com.formdev.flatlaf.util.DerivedColor [UI] darken(5% autoInverse) Slider.minimumHorizontalSize 36,21 java.awt.Dimension Slider.minimumVerticalSize 21,36 java.awt.Dimension Slider.onlyLeftMouseButtonDrag true -Slider.pressedThumbColor #166ec5 HSL 210 80 43 com.formdev.flatlaf.util.DerivedColor [UI] darken(8% autoInverse) +Slider.pressedThumbColor #1a70c0 HSL 209 76 43 com.formdev.flatlaf.util.DerivedColor [UI] darken(8% autoInverse) Slider.shadow #c4c4c4 HSL 0 0 77 javax.swing.plaf.ColorUIResource [UI] -Slider.thumbColor #1e82e6 HSL 210 80 51 javax.swing.plaf.ColorUIResource [UI] +Slider.thumbColor #2285e1 HSL 209 76 51 javax.swing.plaf.ColorUIResource [UI] Slider.thumbSize 12,12 javax.swing.plaf.DimensionUIResource [UI] Slider.tickColor #888888 HSL 0 0 53 javax.swing.plaf.ColorUIResource [UI] Slider.trackColor #c4c4c4 HSL 0 0 77 javax.swing.plaf.ColorUIResource [UI] -Slider.trackValueColor #1e82e6 HSL 210 80 51 javax.swing.plaf.ColorUIResource [UI] +Slider.trackValueColor #2285e1 HSL 209 76 51 javax.swing.plaf.ColorUIResource [UI] Slider.trackWidth 2 Slider.verticalSize 21,200 java.awt.Dimension SliderUI com.formdev.flatlaf.ui.FlatSliderUI @@ -1051,7 +1051,7 @@ TabbedPane.tabsOpaque true TabbedPane.tabsOverlapBorder false TabbedPane.tabsPopupPolicy asNeeded TabbedPane.textIconGap 4 -TabbedPane.underlineColor #4083c9 HSL 211 56 52 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.underlineColor #3c83c5 HSL 209 54 50 javax.swing.plaf.ColorUIResource [UI] TabbedPaneUI com.formdev.flatlaf.ui.FlatTabbedPaneUI @@ -1253,7 +1253,7 @@ ToggleButton.shadow #c4c4c4 HSL 0 0 77 javax.swing.plaf.Colo ToggleButton.tab.disabledUnderlineColor #ababab HSL 0 0 67 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.focusBackground #dee6ed HSL 208 29 90 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.hoverBackground #e0e0e0 HSL 0 0 88 com.formdev.flatlaf.util.DerivedColor [UI] darken(7% autoInverse) -ToggleButton.tab.underlineColor #4083c9 HSL 211 56 52 javax.swing.plaf.ColorUIResource [UI] +ToggleButton.tab.underlineColor #3c83c5 HSL 209 54 50 javax.swing.plaf.ColorUIResource [UI] ToggleButton.tab.underlineHeight 2 ToggleButton.textIconGap 4 ToggleButton.textShiftOffset 0 From 9b465cb550bd9a43000dc6d18e5d4a658a03fc16 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 9 Aug 2021 19:27:49 +0200 Subject: [PATCH 03/12] Accent color: added `FlatLaf.setExtraDefaults()` for easy setting accent color at runtime (issue #233) --- .../java/com/formdev/flatlaf/FlatLaf.java | 40 ++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index 9ff1ff0a..0b29bcdb 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -86,6 +86,7 @@ public abstract class FlatLaf private static final String DESKTOPFONTHINTS = "awt.font.desktophints"; private static List customDefaultsSources; + private Map extraDefaults; private String desktopPropertyName; private String desktopPropertyName2; @@ -464,7 +465,12 @@ public abstract class FlatLaf } protected Properties getAdditionalDefaults() { - return null; + if( extraDefaults == null ) + return null; + + Properties properties = new Properties(); + properties.putAll( extraDefaults ); + return properties; } private void initResourceBundle( UIDefaults defaults, String bundleName ) { @@ -779,6 +785,38 @@ public abstract class FlatLaf customDefaultsSources.remove( folder ); } + /** + * Gets extra UI defaults; or {@code null}. + * + * @since 1.6 + */ + public Map getExtraDefaults() { + return extraDefaults; + } + + /** + * Sets extra UI defaults, which are only used when setting up the application look and feel. + * E.g. using {@link UIManager#setLookAndFeel(LookAndFeel)} or {@link #setup(LookAndFeel)}. + *

+ * The extra defaults are useful for smaller additional defaults that may change. + * E.g. accent color. Otherwise FlatLaf properties files should be used. + * See {@link #registerCustomDefaultsSource(String)}. + *

+ * The keys and values are strings in same format as in FlatLaf properties files. + *

+ * Sample that setups "FlatLaf Light" theme with red accent color: + *

{@code
+	 * FlatLaf laf = new FlatLightLaf();
+	 * laf.setExtraDefaults( Collections.singletonMap( "@accentColor", "#f00" ) );
+	 * FlatLaf.setup( laf );
+	 * }
+ * + * @since 1.6 + */ + public void setExtraDefaults( Map extraDefaults ) { + this.extraDefaults = extraDefaults; + } + private static void reSetLookAndFeel() { EventQueue.invokeLater( () -> { LookAndFeel lookAndFeel = UIManager.getLookAndFeel(); From 7f9cf6f45c04a331212a3ca4c84eedff1b277059 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 30 Aug 2021 23:58:37 +0200 Subject: [PATCH 04/12] UIDefaultsLoader: added contrast() color function (inspired by Less CSS), which is useful to choose a foreground color that is readable, based on the luma (perceptual brightness) of a background color --- .../com/formdev/flatlaf/UIDefaultsLoader.java | 37 +++++++++++++--- .../formdev/flatlaf/util/ColorFunctions.java | 28 ++++++++++++ .../flatlaf/util/TestColorFunctions.java | 44 +++++++++++++++++++ .../themeeditor/FlatCompletionProvider.java | 6 +++ .../themeeditor/FlatThemeEditorOverlay.java | 24 +++++++--- .../themeeditor/FlatThemeFileEditor.java | 24 +++++++--- .../themeeditor/FlatThemeFileEditor.jfd | 5 +++ .../themeeditor/FlatThemeTokenMaker.java | 1 + .../theme-editor-test.properties | 29 ++++++++++++ 9 files changed, 180 insertions(+), 18 deletions(-) create mode 100644 flatlaf-core/src/test/java/com/formdev/flatlaf/util/TestColorFunctions.java diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index 1b6d1ab3..a63fd6bd 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -611,6 +611,7 @@ class UIDefaultsLoader case "mix": return parseColorMix( null, params, resolver, reportError ); case "tint": return parseColorMix( "#fff", params, resolver, reportError ); case "shade": return parseColorMix( "#000", params, resolver, reportError ); + case "contrast": return parseColorContrast( params, resolver, reportError ); } } finally { parseColorDepth--; @@ -804,14 +805,10 @@ class UIDefaultsLoader if( color1Str == null ) color1Str = params.get( i++ ); String color2Str = params.get( i++ ); - int weight = 50; - - if( params.size() > i ) - weight = parsePercentage( params.get( i++ ) ); + int weight = (params.size() > i) ? parsePercentage( params.get( i ) ) : 50; // parse second color - String resolvedColor2Str = resolver.apply( color2Str ); - ColorUIResource color2 = (ColorUIResource) parseColorOrFunction( resolvedColor2Str, resolver, reportError ); + ColorUIResource color2 = (ColorUIResource) parseColorOrFunction( resolver.apply( color2Str ), resolver, reportError ); if( color2 == null ) return null; @@ -822,6 +819,34 @@ class UIDefaultsLoader return parseFunctionBaseColor( color1Str, function, false, resolver, reportError ); } + /** + * Syntax: contrast(color,dark,light[,threshold]) + * - color: a color to compare against + * - dark: a designated dark color (e.g. #000) or a color function + * - light: a designated light color (e.g. #fff) or a color function + * - threshold: the threshold (in range 0-100%) to specify where the transition + * from "dark" to "light" is (default is 43%) + */ + private static Object parseColorContrast( List params, Function resolver, boolean reportError ) { + String colorStr = params.get( 0 ); + String darkStr = params.get( 1 ); + String lightStr = params.get( 2 ); + int threshold = (params.size() > 3) ? parsePercentage( params.get( 3 ) ) : 43; + + // parse color to compare against + ColorUIResource color = (ColorUIResource) parseColorOrFunction( resolver.apply( colorStr ), resolver, reportError ); + if( color == null ) + return null; + + // check luma and determine whether to use dark or light color + String darkOrLightColor = (ColorFunctions.luma( color ) * 100 < threshold) + ? lightStr + : darkStr; + + // parse dark or light color + return parseColorOrFunction( resolver.apply( darkOrLightColor ), resolver, reportError ); + } + private static Object parseFunctionBaseColor( String colorStr, ColorFunction function, boolean derived, Function resolver, boolean reportError ) { diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java index 0b7e99f9..14fe2ce0 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java @@ -79,6 +79,34 @@ public class ColorFunctions Math.round( a2 + ((a1 - a2) * weight) ) ); } + /** + * Calculates the luma (perceptual brightness) of the given color. + *

+ * Uses SMPTE C / Rec. 709 coefficients, as recommended in + * WCAG 2.0. + * + * @param color a color + * @return the luma (in range 0-1) + * + * @see https://en.wikipedia.org/wiki/Luma_(video) + * @since 1.6 + */ + public static float luma( Color color ) { + // see https://en.wikipedia.org/wiki/Luma_(video) + // see https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + // see https://github.com/less/less.js/blob/master/packages/less/src/less/tree/color.js + float r = gammaCorrection( color.getRed() / 255f ); + float g = gammaCorrection( color.getGreen() / 255f ); + float b = gammaCorrection( color.getBlue() / 255f ); + return (0.2126f * r) + (0.7152f * g) + (0.0722f * b); + } + + private static float gammaCorrection( float value ) { + return (value <= 0.03928f) + ? value / 12.92f + : (float) Math.pow( (value + 0.055) / 1.055, 2.4 ); + } + //---- interface ColorFunction -------------------------------------------- public interface ColorFunction { diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/util/TestColorFunctions.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/util/TestColorFunctions.java new file mode 100644 index 00000000..74843273 --- /dev/null +++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/util/TestColorFunctions.java @@ -0,0 +1,44 @@ +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import java.awt.Color; +import org.junit.jupiter.api.Test; + +/** + * @author Karl Tauber + */ +public class TestColorFunctions +{ + @Test + void luma() { + assertEquals( 0, ColorFunctions.luma( Color.black ) ); + assertEquals( 1, ColorFunctions.luma( Color.white ) ); + + assertEquals( 0.2126f, ColorFunctions.luma( Color.red ) ); + assertEquals( 0.7152f, ColorFunctions.luma( Color.green ) ); + assertEquals( 0.0722f, ColorFunctions.luma( Color.blue ) ); + + assertEquals( 0.9278f, ColorFunctions.luma( Color.yellow ) ); + assertEquals( 0.7874f, ColorFunctions.luma( Color.cyan ) ); + + assertEquals( 0.051269464f, ColorFunctions.luma( Color.darkGray ) ); + assertEquals( 0.21586052f, ColorFunctions.luma( Color.gray ) ); + assertEquals( 0.52711517f, ColorFunctions.luma( Color.lightGray ) ); + } +} diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java index c9522891..2f333a13 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java @@ -471,6 +471,12 @@ class FlatCompletionProvider addFunction( "shade", "color", colorParamDesc, "weight", weightParamDesc ); + + addFunction( "contrast", + "color", colorParamDesc, + "dark", colorParamDesc, + "light", colorParamDesc, + "threshold", "(optional) 0-100%, default is 43%" ); } private void addFunction( String name, String... paramNamesAndDescs ) { diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorOverlay.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorOverlay.java index e769a37c..f3584a5f 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorOverlay.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeEditorOverlay.java @@ -31,6 +31,7 @@ import org.fife.ui.rsyntaxtextarea.Token; import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.UIDefaultsLoaderAccessor; import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.ColorFunctions; import com.formdev.flatlaf.util.HSLColor; import com.formdev.flatlaf.util.UIScale; @@ -46,6 +47,7 @@ class FlatThemeEditorOverlay static boolean showHSL = true; static boolean showRGB; + static boolean showLuma; private Font font; private Font baseFont; @@ -80,19 +82,21 @@ class FlatThemeEditorOverlay } FontMetrics fm = c.getFontMetrics( font ); + int space = fm.stringWidth( " " ); int maxTextWidth = 0; if( showHSL ) - maxTextWidth += fm.stringWidth( "HSL 360 100 100" ); + maxTextWidth += fm.stringWidth( "HSL 360 100 100" ) + space; if( showRGB ) - maxTextWidth += fm.stringWidth( "#ffffff" ); - if( showHSL && showRGB ) - maxTextWidth += fm.stringWidth( " " ); + maxTextWidth += fm.stringWidth( "#ffffff" ) + space; + if( showLuma ) + maxTextWidth += fm.stringWidth( "100" ) + space; + maxTextWidth = Math.max( maxTextWidth - space, 0 ); int textHeight = fm.getAscent() - fm.getLeading(); int width = c.getWidth(); int previewWidth = UIScale.scale( COLOR_PREVIEW_WIDTH ); int gap = UIScale.scale( 4 ); - int textGap = (showHSL || showRGB) ? UIScale.scale( 6 ) : 0; + int textGap = (showHSL || showRGB || showLuma) ? UIScale.scale( 6 ) : 0; // check whether preview is outside of clip bounds if( clipBounds.x + clipBounds.width < width - previewWidth - maxTextWidth - gap - textGap ) @@ -123,7 +127,7 @@ class FlatThemeEditorOverlay } // paint text - if( showHSL || showRGB ) { + if( showHSL || showRGB || showLuma ) { int textX = px - textGap - maxTextWidth; if( textX > r.x + gap) { String colorStr = null; @@ -141,6 +145,14 @@ class FlatThemeEditorOverlay else colorStr = rgbStr; } + if( showLuma ) { + String lumaStr = String.format( "%3d", + Math.round( ColorFunctions.luma( color ) * 100 ) ); + if( colorStr != null ) + colorStr += " " + lumaStr; + else + colorStr = lumaStr; + } int textWidth = fm.stringWidth( colorStr ); if( textWidth > maxTextWidth ) diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java index c3b53a64..4acbe91f 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.java @@ -83,8 +83,9 @@ class FlatThemeFileEditor private static final String KEY_PREVIEW = "preview"; private static final String KEY_LAF = "laf"; private static final String KEY_FONT_SIZE_INCR = "fontSizeIncr"; - private static final String KEY_HSL_COLORS = "hslColors"; - private static final String KEY_RGB_COLORS = "rgbColors"; + private static final String KEY_SHOW_HSL_COLORS = "showHslColors"; + private static final String KEY_SHOW_RGB_COLORS = "showRgbColors"; + private static final String KEY_SHOW_COLOR_LUMA = "showColorLuma"; private File dir; private Preferences state; @@ -701,9 +702,11 @@ class FlatThemeFileEditor private void colorModelChanged() { FlatThemeEditorOverlay.showHSL = showHSLColorsMenuItem.isSelected(); FlatThemeEditorOverlay.showRGB = showRGBColorsMenuItem.isSelected(); + FlatThemeEditorOverlay.showLuma = showColorLumaMenuItem.isSelected(); - putPrefsBoolean( state, KEY_HSL_COLORS, FlatThemeEditorOverlay.showHSL, true ); - putPrefsBoolean( state, KEY_RGB_COLORS, FlatThemeEditorOverlay.showRGB, false ); + putPrefsBoolean( state, KEY_SHOW_HSL_COLORS, FlatThemeEditorOverlay.showHSL, true ); + putPrefsBoolean( state, KEY_SHOW_RGB_COLORS, FlatThemeEditorOverlay.showRGB, false ); + putPrefsBoolean( state, KEY_SHOW_COLOR_LUMA, FlatThemeEditorOverlay.showLuma, false ); repaint(); } @@ -755,13 +758,15 @@ class FlatThemeFileEditor directoryField.setModel( model ); // restore overlay color models - FlatThemeEditorOverlay.showHSL = state.getBoolean( KEY_HSL_COLORS, true ); - FlatThemeEditorOverlay.showRGB = state.getBoolean( KEY_RGB_COLORS, false ); + FlatThemeEditorOverlay.showHSL = state.getBoolean( KEY_SHOW_HSL_COLORS, true ); + FlatThemeEditorOverlay.showRGB = state.getBoolean( KEY_SHOW_RGB_COLORS, false ); + FlatThemeEditorOverlay.showLuma = state.getBoolean( KEY_SHOW_COLOR_LUMA, false ); // restore menu item selection previewMenuItem.setSelected( state.getBoolean( KEY_PREVIEW, true ) ); showHSLColorsMenuItem.setSelected( FlatThemeEditorOverlay.showHSL ); showRGBColorsMenuItem.setSelected( FlatThemeEditorOverlay.showRGB ); + showColorLumaMenuItem.setSelected( FlatThemeEditorOverlay.showLuma ); } private void saveState() { @@ -877,6 +882,7 @@ class FlatThemeFileEditor resetFontSizeMenuItem = new JMenuItem(); showHSLColorsMenuItem = new JCheckBoxMenuItem(); showRGBColorsMenuItem = new JCheckBoxMenuItem(); + showColorLumaMenuItem = new JCheckBoxMenuItem(); windowMenu = new JMenu(); activateEditorMenuItem = new JMenuItem(); nextEditorMenuItem = new JMenuItem(); @@ -1024,6 +1030,11 @@ class FlatThemeFileEditor showRGBColorsMenuItem.setText("Show RGB colors (hex)"); showRGBColorsMenuItem.addActionListener(e -> colorModelChanged()); viewMenu.add(showRGBColorsMenuItem); + + //---- showColorLumaMenuItem ---- + showColorLumaMenuItem.setText("Show color luma"); + showColorLumaMenuItem.addActionListener(e -> colorModelChanged()); + viewMenu.add(showColorLumaMenuItem); } menuBar.add(viewMenu); @@ -1133,6 +1144,7 @@ class FlatThemeFileEditor private JMenuItem resetFontSizeMenuItem; private JCheckBoxMenuItem showHSLColorsMenuItem; private JCheckBoxMenuItem showRGBColorsMenuItem; + private JCheckBoxMenuItem showColorLumaMenuItem; private JMenu windowMenu; private JMenuItem activateEditorMenuItem; private JMenuItem nextEditorMenuItem; diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd index f6f2f336..1b080599 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeFileEditor.jfd @@ -177,6 +177,11 @@ new FormModel { "text": "Show RGB colors (hex)" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "colorModelChanged", false ) ) } ) + add( new FormComponent( "javax.swing.JCheckBoxMenuItem" ) { + name: "showColorLumaMenuItem" + "text": "Show color luma" + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "colorModelChanged", false ) ) + } ) } ) add( new FormContainer( "javax.swing.JMenu", new FormLayoutManager( class javax.swing.JMenu ) ) { name: "windowMenu" diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java index 6f540cdf..f8dbcea9 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java @@ -71,6 +71,7 @@ public class FlatThemeTokenMaker tokenMap.put( "mix", TOKEN_FUNCTION ); tokenMap.put( "tint", TOKEN_FUNCTION ); tokenMap.put( "shade", TOKEN_FUNCTION ); + tokenMap.put( "contrast", TOKEN_FUNCTION ); tokenMap.put( "lazy", TOKEN_FUNCTION ); // function options diff --git a/flatlaf-theme-editor/theme-editor-test.properties b/flatlaf-theme-editor/theme-editor-test.properties index 66a11c82..46a84560 100644 --- a/flatlaf-theme-editor/theme-editor-test.properties +++ b/flatlaf-theme-editor/theme-editor-test.properties @@ -70,3 +70,32 @@ Prop.colorFunc42 = tint(#f0f,75%) Prop.colorFunc45 = shade(#f0f,25%) Prop.colorFunc46 = shade(#f0f) Prop.colorFunc47 = shade(#f0f,75%) + +Prop.colorFunc50 = contrast(#111,#000,#fff) +Prop.colorFunc51 = contrast(#eee,#000,#fff) +Prop.colorFunc52 = contrast(#111,$Prop.colorFunc1,$Prop.colorFunc3) +Prop.colorFunc53 = contrast(#eee,$Prop.colorFunc1,$Prop.colorFunc3) +Prop.colorFunc54 = contrast(lighten(#111,5%),$Prop.colorFunc1,$Prop.colorFunc3) +Prop.colorFunc55 = contrast(lighten(#eee,5%),$Prop.colorFunc1,$Prop.colorFunc3) +Prop.colorFunc56 = contrast(contrast(#222,#111,#eee),contrast(#eee,#000,#fff),contrast(#111,#000,#fff)) + +Prop.1.selectionBackground = #2675BF +Prop.1.selectionForeground = contrast($Prop.1.selectionBackground,#000,#fff) + +Prop.2.selectionBackground = #95c0e9 +Prop.2.selectionForeground = contrast($Prop.2.selectionBackground,#000,#fff) + +Prop.3.selectionBackground = #f00 +Prop.3.selectionForeground = contrast($Prop.3.selectionBackground,#000,#fff) + +Prop.4.selectionBackground = #0f0 +Prop.4.selectionForeground = contrast($Prop.4.selectionBackground,#000,#fff) + +Prop.5.selectionBackground = #00f +Prop.5.selectionForeground = contrast($Prop.5.selectionBackground,#000,#fff) + +Prop.6.selectionBackground = #FFCC00 +Prop.6.selectionForeground = contrast($Prop.6.selectionBackground,#000,#fff) + +Prop.7.selectionBackground = #FF9500 +Prop.7.selectionForeground = contrast($Prop.7.selectionBackground,#000,#fff) From d333d0c9e43337127c85e0f0c0f805e68fdc5117 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 31 Aug 2021 14:06:41 +0200 Subject: [PATCH 05/12] Accent color: - Demo: added accent color switching to toolbar - added `FlatLaf.setGlobalExtraDefaults()` for easy setting accent color at runtime (issue #233) --- .../java/com/formdev/flatlaf/FlatLaf.java | 41 +++++- .../formdev/flatlaf/util/ColorFunctions.java | 31 ++++ .../flatlaf/FlatIntelliJLaf.properties | 2 +- .../com/formdev/flatlaf/demo/DemoFrame.java | 134 ++++++++++++++++-- .../com/formdev/flatlaf/demo/DemoFrame.jfd | 7 +- .../flatlaf/demo/FlatDarkLaf.properties | 12 ++ .../flatlaf/demo/FlatLightLaf.properties | 12 ++ 7 files changed, 220 insertions(+), 19 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index 0b29bcdb..10119c2d 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -86,6 +86,7 @@ public abstract class FlatLaf private static final String DESKTOPFONTHINTS = "awt.font.desktophints"; private static List customDefaultsSources; + private static Map globalExtraDefaults; private Map extraDefaults; private String desktopPropertyName; @@ -465,11 +466,14 @@ public abstract class FlatLaf } protected Properties getAdditionalDefaults() { - if( extraDefaults == null ) + if( globalExtraDefaults == null && extraDefaults == null ) return null; Properties properties = new Properties(); - properties.putAll( extraDefaults ); + if( globalExtraDefaults != null ) + properties.putAll( globalExtraDefaults ); + if( extraDefaults != null ) + properties.putAll( extraDefaults ); return properties; } @@ -785,6 +789,38 @@ public abstract class FlatLaf customDefaultsSources.remove( folder ); } + /** + * Gets global extra UI defaults; or {@code null}. + * + * @since 1.6 + */ + public static Map getGlobalExtraDefaults() { + return globalExtraDefaults; + } + + /** + * Sets global extra UI defaults, which are only used when setting up the application look and feel. + * E.g. using {@link UIManager#setLookAndFeel(LookAndFeel)} or {@link #setup(LookAndFeel)}. + *

+ * The global extra defaults are useful for smaller additional defaults that may change. + * E.g. accent color. Otherwise FlatLaf properties files should be used. + * See {@link #registerCustomDefaultsSource(String)}. + *

+ * The keys and values are strings in same format as in FlatLaf properties files. + *

+ * Sample that setups "FlatLaf Light" theme with red accent color: + *

{@code
+	 * FlatLaf.setGlobalExtraDefaults( Collections.singletonMap( "@accentColor", "#f00" ) );
+	 * FlatLightLaf.setup();
+	 * }
+ * + * @see #setExtraDefaults(Map) + * @since 1.6 + */ + public static void setGlobalExtraDefaults( Map globalExtraDefaults ) { + FlatLaf.globalExtraDefaults = globalExtraDefaults; + } + /** * Gets extra UI defaults; or {@code null}. * @@ -811,6 +847,7 @@ public abstract class FlatLaf * FlatLaf.setup( laf ); * } * + * @see #setGlobalExtraDefaults(Map) * @since 1.6 */ public void setExtraDefaults( Map extraDefaults ) { diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java index 14fe2ce0..eca7fe3a 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java @@ -49,6 +49,9 @@ public class ColorFunctions /** * Returns a color that is a mixture of two colors. + *

+ * This can be used to animate a color change from {@code color1} to {@code color2} + * by invoking this method multiple times with growing {@code weight} (from 0 to 1). * * @param color1 first color * @param color2 second color @@ -79,6 +82,34 @@ public class ColorFunctions Math.round( a2 + ((a1 - a2) * weight) ) ); } + /** + * Mix color with white, which makes the color brighter. + * This is the same as {@link #mix}{@code (Color.white, color, weight)}. + * + * @param color second color + * @param weight the weight (in range 0-1) to mix the two colors. + * Larger weight uses more of first color, smaller weight more of second color. + * @return mixture of colors + * @since 1.6 + */ + public static Color tint( Color color, float weight ) { + return mix( Color.white, color, weight ); + } + + /** + * Mix color with black, which makes the color darker. + * This is the same as {@link #mix}{@code (Color.black, color, weight)}. + * + * @param color second color + * @param weight the weight (in range 0-1) to mix the two colors. + * Larger weight uses more of first color, smaller weight more of second color. + * @return mixture of colors + * @since 1.6 + */ + public static Color shade( Color color, float weight ) { + return mix( Color.black, color, weight ); + } + /** * Calculates the luma (perceptual brightness) of the given color. *

diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index 918023b3..bde21c6c 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -41,7 +41,7 @@ Button.focusedBackground = null Button.default.background = @accentButtonDefaultBackground -Button.default.foreground = #fff +Button.default.foreground = contrast($Button.default.background,lighten(@foreground,50%),#fff,50%) Button.default.focusedBackground = null Button.default.borderColor = shade($Button.default.background,15%) Button.default.hoverBorderColor = tint($Button.default.background,50%) diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java index 942d2472..22391701 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java @@ -24,11 +24,16 @@ import java.net.URISyntaxException; import java.time.Year; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.prefs.Preferences; import javax.swing.*; import javax.swing.text.DefaultEditorKit; import javax.swing.text.StyleContext; +import com.formdev.flatlaf.FlatDarculaLaf; +import com.formdev.flatlaf.FlatDarkLaf; +import com.formdev.flatlaf.FlatIntelliJLaf; import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.demo.HintManager.Hint; import com.formdev.flatlaf.demo.extras.*; import com.formdev.flatlaf.demo.intellijthemes.*; @@ -37,9 +42,12 @@ import com.formdev.flatlaf.extras.FlatSVGIcon; import com.formdev.flatlaf.extras.FlatUIDefaultsInspector; import com.formdev.flatlaf.extras.components.FlatButton; import com.formdev.flatlaf.extras.components.FlatButton.ButtonType; +import com.formdev.flatlaf.icons.FlatAbstractIcon; import com.formdev.flatlaf.extras.FlatSVGUtils; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.JBRCustomDecorations; +import com.formdev.flatlaf.util.ColorFunctions; +import com.formdev.flatlaf.util.LoggingFacade; import com.formdev.flatlaf.util.SystemInfo; import com.formdev.flatlaf.util.UIScale; import net.miginfocom.layout.ConstraintParser; @@ -65,6 +73,7 @@ class DemoFrame initComponents(); updateFontMenuItems(); + initAccentColors(); controlBar.initialize( this, tabbedPane ); setIconImages( FlatSVGUtils.createWindowIconImages( "/com/formdev/flatlaf/demo/FlatLaf.svg" ) ); @@ -323,6 +332,74 @@ class DemoFrame item.setEnabled( enabled ); } + // the real colors are defined in + // flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties and + // flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties + private static String[] accentColorKeys = { + "Demo.accent.blue", "Demo.accent.purple", "Demo.accent.red", + "Demo.accent.orange", "Demo.accent.yellow", "Demo.accent.green", + }; + private final JToggleButton[] accentColorButtons = new JToggleButton[accentColorKeys.length]; + private JLabel accentColorLabel; + + private void initAccentColors() { + accentColorLabel = new JLabel( "Accent color:" ); + + toolBar.add( Box.createHorizontalGlue() ); + toolBar.add( accentColorLabel ); + + ButtonGroup group = new ButtonGroup(); + for( int i = 0; i < accentColorButtons.length; i++ ) { + accentColorButtons[i] = new JToggleButton( new AccentColorIcon( accentColorKeys[i] ) ); + accentColorButtons[i].addActionListener( this::accentColorChanged ); + toolBar.add( accentColorButtons[i] ); + group.add( accentColorButtons[i] ); + } + + accentColorButtons[0].setSelected( true ); + + UIManager.addPropertyChangeListener( e -> { + if( "lookAndFeel".equals( e.getPropertyName() ) ) + updateAccentColorButtons(); + } ); + updateAccentColorButtons(); + } + + private void accentColorChanged( ActionEvent e ) { + String accentColor = accentColorKeys[0]; + for( int i = 0; i < accentColorButtons.length; i++ ) { + if( accentColorButtons[i].isSelected() ) { + accentColor = accentColorKeys[i]; + break; + } + } + + FlatLaf.setGlobalExtraDefaults( (accentColor != accentColorKeys[0]) + ? Collections.singletonMap( "@accentColor", "$" + accentColor ) + : null ); + + Class lafClass = UIManager.getLookAndFeel().getClass(); + try { + FlatLaf.setup( lafClass.newInstance() ); + FlatLaf.updateUI(); + } catch( InstantiationException | IllegalAccessException ex ) { + LoggingFacade.INSTANCE.logSevere( null, ex ); + } + } + + private void updateAccentColorButtons() { + Class lafClass = UIManager.getLookAndFeel().getClass(); + boolean isAccentColorSupported = + lafClass == FlatLightLaf.class || + lafClass == FlatDarkLaf.class || + lafClass == FlatIntelliJLaf.class || + lafClass == FlatDarculaLaf.class; + + accentColorLabel.setEnabled( isAccentColorSupported ); + for( int i = 0; i < accentColorButtons.length; i++ ) + accentColorButtons[i].setEnabled( isAccentColorSupported ); + } + private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents JMenuBar menuBar1 = new JMenuBar(); @@ -369,7 +446,7 @@ class DemoFrame JMenuItem showUIDefaultsInspectorMenuItem = new JMenuItem(); JMenu helpMenu = new JMenu(); JMenuItem aboutMenuItem = new JMenuItem(); - JToolBar toolBar1 = new JToolBar(); + toolBar = new JToolBar(); JButton backButton = new JButton(); JButton forwardButton = new JButton(); JButton cutButton = new JButton(); @@ -671,43 +748,43 @@ class DemoFrame } setJMenuBar(menuBar1); - //======== toolBar1 ======== + //======== toolBar ======== { - toolBar1.setMargin(new Insets(3, 3, 3, 3)); + toolBar.setMargin(new Insets(3, 3, 3, 3)); //---- backButton ---- backButton.setToolTipText("Back"); - toolBar1.add(backButton); + toolBar.add(backButton); //---- forwardButton ---- forwardButton.setToolTipText("Forward"); - toolBar1.add(forwardButton); - toolBar1.addSeparator(); + toolBar.add(forwardButton); + toolBar.addSeparator(); //---- cutButton ---- cutButton.setToolTipText("Cut"); - toolBar1.add(cutButton); + toolBar.add(cutButton); //---- copyButton ---- copyButton.setToolTipText("Copy"); - toolBar1.add(copyButton); + toolBar.add(copyButton); //---- pasteButton ---- pasteButton.setToolTipText("Paste"); - toolBar1.add(pasteButton); - toolBar1.addSeparator(); + toolBar.add(pasteButton); + toolBar.addSeparator(); //---- refreshButton ---- refreshButton.setToolTipText("Refresh"); - toolBar1.add(refreshButton); - toolBar1.addSeparator(); + toolBar.add(refreshButton); + toolBar.addSeparator(); //---- showToggleButton ---- showToggleButton.setSelected(true); showToggleButton.setToolTipText("Show Details"); - toolBar1.add(showToggleButton); + toolBar.add(showToggleButton); } - contentPane.add(toolBar1, BorderLayout.NORTH); + contentPane.add(toolBar, BorderLayout.NORTH); //======== contentPanel ======== { @@ -813,8 +890,37 @@ class DemoFrame private JCheckBoxMenuItem underlineMenuSelectionMenuItem; private JCheckBoxMenuItem alwaysShowMnemonicsMenuItem; private JCheckBoxMenuItem animatedLafChangeMenuItem; + private JToolBar toolBar; private JTabbedPane tabbedPane; private ControlBar controlBar; IJThemesPanel themesPanel; // JFormDesigner - End of variables declaration //GEN-END:variables + + //---- class AccentColorIcon ---------------------------------------------- + + private static class AccentColorIcon + extends FlatAbstractIcon + { + private final String colorKey; + + AccentColorIcon( String colorKey ) { + super( 16, 16, null ); + this.colorKey = colorKey; + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + Color color = UIManager.getColor( colorKey ); + if( color == null ) + color = Color.lightGray; + else if( !c.isEnabled() ) { + color = FlatLaf.isLafDark() + ? ColorFunctions.shade( color, 0.5f ) + : ColorFunctions.tint( color, 0.6f ); + } + + g.setColor( color ); + g.fillRoundRect( 1, 1, width - 2, height - 2, 5, 5 ); + } + } } diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd index 4087ab97..b74c088c 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.3.1.342" Java: "16" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.4.0.360" Java: "11.0.11" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -13,8 +13,11 @@ new FormModel { "$locationPolicy": 2 "$sizePolicy": 2 add( new FormContainer( "javax.swing.JToolBar", new FormLayoutManager( class javax.swing.JToolBar ) ) { - name: "toolBar1" + name: "toolBar" "margin": new java.awt.Insets( 3, 3, 3, 3 ) + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } add( new FormComponent( "javax.swing.JButton" ) { name: "backButton" "toolTipText": "Back" diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties index 803f03b8..e87ea1e1 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties @@ -14,4 +14,16 @@ # limitations under the License. # +#---- Demo.accent ---- + +Demo.accent.blue = #4B6EAF +Demo.accent.purple = #BF5AF2 +Demo.accent.red = #e81123 +Demo.accent.orange = #FF9F0A +Demo.accent.yellow = #FFCC00 +Demo.accent.green = #32D74B + + +#---- HintPanel ---- + HintPanel.backgroundColor = darken(#ffffe1,80%) diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties index 1b848c29..da420470 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties @@ -14,4 +14,16 @@ # limitations under the License. # +#---- Demo.accent ---- + +Demo.accent.blue = #2675BF +Demo.accent.purple = #BF5AF2 +Demo.accent.red = #FF3B30 +Demo.accent.orange = #FF9500 +Demo.accent.yellow = #FFCC00 +Demo.accent.green = #28CD41 + + +#---- HintPanel ---- + HintPanel.backgroundColor = #ffffe1 From 36d5747fbf41d573a3e424cdafd9a5e6e7196e76 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 25 Sep 2021 23:53:57 +0200 Subject: [PATCH 06/12] Accent color: changed javadoc since version from 1.6 to 2 --- .../src/main/java/com/formdev/flatlaf/FlatLaf.java | 8 ++++---- .../java/com/formdev/flatlaf/util/ColorFunctions.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java index 10119c2d..eec33179 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatLaf.java @@ -792,7 +792,7 @@ public abstract class FlatLaf /** * Gets global extra UI defaults; or {@code null}. * - * @since 1.6 + * @since 2 */ public static Map getGlobalExtraDefaults() { return globalExtraDefaults; @@ -815,7 +815,7 @@ public abstract class FlatLaf * } * * @see #setExtraDefaults(Map) - * @since 1.6 + * @since 2 */ public static void setGlobalExtraDefaults( Map globalExtraDefaults ) { FlatLaf.globalExtraDefaults = globalExtraDefaults; @@ -824,7 +824,7 @@ public abstract class FlatLaf /** * Gets extra UI defaults; or {@code null}. * - * @since 1.6 + * @since 2 */ public Map getExtraDefaults() { return extraDefaults; @@ -848,7 +848,7 @@ public abstract class FlatLaf * } * * @see #setGlobalExtraDefaults(Map) - * @since 1.6 + * @since 2 */ public void setExtraDefaults( Map extraDefaults ) { this.extraDefaults = extraDefaults; diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java index eca7fe3a..fd223930 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/util/ColorFunctions.java @@ -90,7 +90,7 @@ public class ColorFunctions * @param weight the weight (in range 0-1) to mix the two colors. * Larger weight uses more of first color, smaller weight more of second color. * @return mixture of colors - * @since 1.6 + * @since 2 */ public static Color tint( Color color, float weight ) { return mix( Color.white, color, weight ); @@ -104,7 +104,7 @@ public class ColorFunctions * @param weight the weight (in range 0-1) to mix the two colors. * Larger weight uses more of first color, smaller weight more of second color. * @return mixture of colors - * @since 1.6 + * @since 2 */ public static Color shade( Color color, float weight ) { return mix( Color.black, color, weight ); @@ -120,7 +120,7 @@ public class ColorFunctions * @return the luma (in range 0-1) * * @see https://en.wikipedia.org/wiki/Luma_(video) - * @since 1.6 + * @since 2 */ public static float luma( Color color ) { // see https://en.wikipedia.org/wiki/Luma_(video) From a4ea88f4be50348ac357588dcfd51d13c594e91d Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sun, 26 Sep 2021 23:54:06 +0200 Subject: [PATCH 07/12] UIDefaultsLoader: added if() function (inspired by Less CSS) --- .../com/formdev/flatlaf/UIDefaultsLoader.java | 54 ++++++++++++++++++- .../themeeditor/FlatCompletionProvider.java | 7 +++ .../themeeditor/FlatThemeTokenMaker.java | 7 ++- .../theme-editor-test.properties | 18 +++++++ 4 files changed, 83 insertions(+), 3 deletions(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java index a63fd6bd..723ca6f9 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/UIDefaultsLoader.java @@ -312,6 +312,24 @@ class UIDefaultsLoader case "true": resultValueType[0] = ValueType.BOOLEAN; return true; } + // check for function "if" + // Syntax: if(condition,trueValue,falseValue) + // - condition: evaluates to true if: + // - is not "null" + // - is not "false" + // - is not an integer with zero value + // - trueValue: used if condition is true + // - falseValue: used if condition is false + if( value.startsWith( "if(" ) && value.endsWith( ")" ) ) { + List params = splitFunctionParams( value.substring( 3, value.length() - 1 ), ',' ); + if( params.size() != 3 ) + throwMissingParametersException( value ); + + boolean ifCondition = parseCondition( params.get( 0 ), resolver, addonClassLoaders ); + String ifValue = params.get( ifCondition ? 1 : 2 ); + return parseValue( key, resolver.apply( ifValue ), resultValueType, resolver, addonClassLoaders ); + } + // check for function "lazy" // Syntax: lazy(uiKey) if( value.startsWith( "lazy(" ) && value.endsWith( ")" ) ) { @@ -420,6 +438,20 @@ class UIDefaultsLoader } } + private static boolean parseCondition( String condition, + Function resolver, List addonClassLoaders ) + { + try { + Object conditionValue = parseValue( "", resolver.apply( condition ), null, resolver, addonClassLoaders ); + return (conditionValue != null && + !conditionValue.equals( false ) && + !conditionValue.equals( 0 ) ); + } catch( IllegalArgumentException ex ) { + // ignore errors (e.g. variable or property not found) and evaluate to false + return false; + } + } + private static Object parseBorder( String value, Function resolver, List addonClassLoaders ) { if( value.indexOf( ',' ) >= 0 ) { // top,left,bottom,right[,lineColor[,lineThickness]] @@ -584,7 +616,7 @@ class UIDefaultsLoader String function = value.substring( 0, paramsStart ).trim(); List params = splitFunctionParams( value.substring( paramsStart + 1, value.length() - 1 ), ',' ); if( params.isEmpty() ) - throw new IllegalArgumentException( "missing parameters in function '" + value + "'" ); + throwMissingParametersException( value ); if( parseColorDepth > 100 ) throw new IllegalArgumentException( "endless recursion in color function '" + value + "'" ); @@ -592,6 +624,7 @@ class UIDefaultsLoader parseColorDepth++; try { switch( function ) { + case "if": return parseColorIf( value, params, resolver, reportError ); case "rgb": return parseColorRgbOrRgba( false, params, resolver, reportError ); case "rgba": return parseColorRgbOrRgba( true, params, resolver, reportError ); case "hsl": return parseColorHslOrHsla( false, params ); @@ -620,6 +653,21 @@ class UIDefaultsLoader throw new IllegalArgumentException( "unknown color function '" + value + "'" ); } + /** + * Syntax: if(condition,trueValue,falseValue) + *

+ * This "if" function is only used if the "if" is passed as parameter to another + * color function. Otherwise the general "if" function is used. + */ + private static Object parseColorIf( String value, List params, Function resolver, boolean reportError ) { + if( params.size() != 3 ) + throwMissingParametersException( value ); + + boolean ifCondition = parseCondition( params.get( 0 ), resolver, Collections.emptyList() ); + String ifValue = params.get( ifCondition ? 1 : 2 ); + return parseColorOrFunction( resolver.apply( ifValue ), resolver, reportError ); + } + /** * Syntax: rgb(red,green,blue) or rgba(red,green,blue,alpha) * - red: an integer 0-255 or a percentage 0-100% @@ -1029,4 +1077,8 @@ class UIDefaultsLoader LoggingFacade.INSTANCE.logSevere( "FlatLaf: '" + uiKey + "' not found in UI defaults.", null ); return value; } + + private static void throwMissingParametersException( String value ) { + throw new IllegalArgumentException( "missing parameters in function '" + value + "'" ); + } } diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java index 2f333a13..ae22afca 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatCompletionProvider.java @@ -405,6 +405,13 @@ class FlatCompletionProvider setParameterizedCompletionParams( '(', ",", ')' ); setParameterChoicesProvider( this ); + addFunction( "if", + "condition", "evaluates to true if: is not \"null\" and is not \"false\" and is not an integer with zero value", + "trueValue", "used if condition is true", + "falseValue", "used if condition is false" ); + addFunction( "lazy", + "uiKey", "UI key (without leading '$')" ); + addFunction( "rgb", "red", "0-255 or 0-100%", "green", "0-255 or 0-100%", diff --git a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java index f8dbcea9..b8eac587 100644 --- a/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java +++ b/flatlaf-theme-editor/src/main/java/com/formdev/flatlaf/themeeditor/FlatThemeTokenMaker.java @@ -51,7 +51,11 @@ public class FlatThemeTokenMaker tokenMap.put( "false", Token.LITERAL_BOOLEAN ); tokenMap.put( "true", Token.LITERAL_BOOLEAN ); - // functions + // general functions + tokenMap.put( "if", TOKEN_FUNCTION ); + tokenMap.put( "lazy", TOKEN_FUNCTION ); + + // color functions tokenMap.put( "rgb", TOKEN_FUNCTION ); tokenMap.put( "rgba", TOKEN_FUNCTION ); tokenMap.put( "hsl", TOKEN_FUNCTION ); @@ -72,7 +76,6 @@ public class FlatThemeTokenMaker tokenMap.put( "tint", TOKEN_FUNCTION ); tokenMap.put( "shade", TOKEN_FUNCTION ); tokenMap.put( "contrast", TOKEN_FUNCTION ); - tokenMap.put( "lazy", TOKEN_FUNCTION ); // function options tokenMap.put( "relative", Token.RESERVED_WORD ); diff --git a/flatlaf-theme-editor/theme-editor-test.properties b/flatlaf-theme-editor/theme-editor-test.properties index 46a84560..7d75455b 100644 --- a/flatlaf-theme-editor/theme-editor-test.properties +++ b/flatlaf-theme-editor/theme-editor-test.properties @@ -29,6 +29,24 @@ Prop.true = true Prop.var = @var1 Prop.ref = $Prop.string +Prop.ifNotNull = if(#000,#0f0,#dfd) +Prop.ifNull = if(null,#0f0,#dfd) +Prop.ifTrue = if(true,#0f0,#dfd) +Prop.ifFalse = if(false,#0f0,#dfd) +Prop.ifOne = if(1,#0f0,#dfd) +Prop.ifZero = if(0,#0f0,#dfd) +@varTrue = true +@varFalse = false +@varTrueValue = #0f0 +@varFalseValue = #dfd +Prop.ifVarTrue = if(@varTrue,@varTrueValue,@varFalseValue) +Prop.ifVarFalse = if(@varFalse,@varTrueValue,@varFalseValue) +Prop.ifTrueColorFunc = if(true,lighten(#f00,20%),darken(#f00,20%)) +Prop.ifFalseColorFunc = if(false,lighten(#f00,20%),darken(#f00,20%)) +Prop.ifUndefinedVar = if(@undefinedVar,#0f0,#dfd) +Prop.ifUndefinedProp = if($undefinedProp,#0f0,#dfd) +Prop.ifColor = lighten(if(#000,#0f0,#dfd), 10%) +Prop.ifColorVar = lighten(if(@varTrue,@varTrueValue,@varFalseValue), 10%) Prop.lazy = lazy(Prop.string) Prop.colorFunc1 = rgb(12,34,56) From 15c6f11a5eb493d91985e4750772d62c1ec9637a Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sun, 26 Sep 2021 23:56:56 +0200 Subject: [PATCH 08/12] Accent color: - introduced @accentBaseColor variable that is now used as base for accent colors in Light/Dark/IntelliJ/Darcula themes, which use variations of the accent color - @accentColor is now `null` by default, but if set to a color, then it is used unmodified for all accents (issue #233) --- .../com/formdev/flatlaf/FlatDarkLaf.properties | 18 +++++++++++------- .../formdev/flatlaf/FlatIntelliJLaf.properties | 2 +- .../formdev/flatlaf/FlatLightLaf.properties | 18 +++++++++++------- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 4c554b12..0d459064 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -49,13 +49,17 @@ @icon = #adadad # accent colors (blueish) -@accentColor = #4B6EAF -@accentFocusColor = shade(spin(@accentColor,-8),20%) -@accentLinkColor = lighten(saturate(spin(@accentColor,-5),50%),16%) -@accentSelectionBackground = @accentColor -@accentSliderColor = @accentUnderlineColor -@accentUnderlineColor = lighten(saturate(spin(@accentColor,-8),13%),5%) -@accentButtonDefaultBackground = darken(spin(@accentColor,-8),13%) +# set @accentColor to use single accent color or +# modify @accentBaseColor to use variations of accent base color +@accentColor = null +@accentBaseColor = #4B6EAF +# accent color variations +@accentFocusColor = if(@accentColor, @accentColor, shade(spin(@accentBaseColor,-8),20%)) +@accentLinkColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-5),50%),16%)) +@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) +@accentSliderColor = if(@accentColor, @accentColor, @accentUnderlineColor) +@accentUnderlineColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-8),13%),5%)) +@accentButtonDefaultBackground = if(@accentColor, @accentColor, darken(spin(@accentBaseColor,-8),13%)) # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #9A9DA1 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index bde21c6c..2d3423fc 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -34,7 +34,7 @@ #---- variables ---- # accent colors (blueish) -@accentButtonDefaultBackground = tint(@accentColor,15%) +@accentButtonDefaultBackground = if(@accentColor, @accentColor, tint(@accentBaseColor,15%)) #---- Button ---- diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index f28cd663..86541caa 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -49,13 +49,17 @@ @icon = #afafaf # accent colors (blueish) -@accentColor = #2675BF -@accentCheckmarkColor = tint(@accentSliderColor,20%) -@accentFocusColor = lighten(@accentColor,31%) -@accentLinkColor = darken(@accentColor,3%) -@accentSelectionBackground = @accentColor -@accentSliderColor = lighten(saturate(@accentColor,10%),6%) -@accentUnderlineColor = tint(@accentColor,10%) +# set @accentColor to use single accent color or +# modify @accentBaseColor to use variations of accent base color +@accentColor = null +@accentBaseColor = #2675BF +# accent color variations +@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) +@accentFocusColor = if(@accentColor, @accentColor, lighten(@accentBaseColor,31%)) +@accentLinkColor = if(@accentColor, @accentColor, darken(@accentBaseColor,3%)) +@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) +@accentSliderColor = if(@accentColor, @accentColor, lighten(saturate(@accentBaseColor,10%),6%)) +@accentUnderlineColor = if(@accentColor, @accentColor, tint(@accentBaseColor,10%)) # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #666 From caf2cd8487088a1fa5590961171781474609d200 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 27 Sep 2021 12:24:45 +0200 Subject: [PATCH 09/12] Accent color: fixed text colors if using light accent color (issue #233) --- .../formdev/flatlaf/FlatDarkLaf.properties | 20 +++++++++---------- .../formdev/flatlaf/FlatLightLaf.properties | 19 +++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 0d459064..7845d865 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -35,8 +35,8 @@ @background = #3c3f41 @foreground = #bbb @selectionBackground = @accentSelectionBackground -@selectionForeground = @foreground -@selectionInactiveBackground =spin(saturate(shade(@selectionBackground,70%),20%),-15) +@selectionForeground = contrast(@selectionBackground,@background,@foreground,39%) +@selectionInactiveBackground = spin(saturate(shade(@selectionBackground,70%),20%),-15) @selectionInactiveForeground = @foreground @disabledText = #888 @textComponentBackground = #45494A @@ -54,12 +54,12 @@ @accentColor = null @accentBaseColor = #4B6EAF # accent color variations -@accentFocusColor = if(@accentColor, @accentColor, shade(spin(@accentBaseColor,-8),20%)) -@accentLinkColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-5),50%),16%)) -@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) -@accentSliderColor = if(@accentColor, @accentColor, @accentUnderlineColor) -@accentUnderlineColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-8),13%),5%)) -@accentButtonDefaultBackground = if(@accentColor, @accentColor, darken(spin(@accentBaseColor,-8),13%)) +@accentFocusColor = if(@accentColor, @accentColor, shade(spin(@accentBaseColor,-8),20%)) +@accentLinkColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-5),50%),16%)) +@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) +@accentSliderColor = if(@accentColor, @accentColor, @accentUnderlineColor) +@accentUnderlineColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-8),13%),5%)) +@accentButtonDefaultBackground = if(@accentColor, @accentColor, darken(spin(@accentBaseColor,-8),13%)) # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #9A9DA1 @@ -100,7 +100,7 @@ Button.hoverBorderColor = $Button.focusedBorderColor Button.innerFocusWidth = 1 Button.default.background = @accentButtonDefaultBackground -Button.default.foreground = @foreground +Button.default.foreground = contrast($Button.default.background,@background,@foreground,25%) Button.default.hoverBackground = lighten($Button.default.background,3%,derived) Button.default.pressedBackground = lighten($Button.default.background,6%,derived) Button.default.borderColor = tint($Button.default.background,15%) @@ -240,8 +240,8 @@ PopupMenu.borderColor = #5e5e5e ProgressBar.background = #555 ProgressBar.foreground = @accentSliderColor -ProgressBar.selectionForeground = @foreground ProgressBar.selectionBackground = @foreground +ProgressBar.selectionForeground = contrast($ProgressBar.foreground,@background,@foreground,39%) #---- RootPane ---- diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index 86541caa..2bd0a9e5 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -35,7 +35,7 @@ @background = #f2f2f2 @foreground = #000 @selectionBackground = @accentSelectionBackground -@selectionForeground = #fff +@selectionForeground = contrast(@selectionBackground,@foreground,#fff) @selectionInactiveBackground = #d4d4d4 @selectionInactiveForeground = @foreground @disabledText = #8C8C8C @@ -54,12 +54,13 @@ @accentColor = null @accentBaseColor = #2675BF # accent color variations -@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) -@accentFocusColor = if(@accentColor, @accentColor, lighten(@accentBaseColor,31%)) -@accentLinkColor = if(@accentColor, @accentColor, darken(@accentBaseColor,3%)) -@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) -@accentSliderColor = if(@accentColor, @accentColor, lighten(saturate(@accentBaseColor,10%),6%)) -@accentUnderlineColor = if(@accentColor, @accentColor, tint(@accentBaseColor,10%)) +@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) +@accentFocusColor = if(@accentColor, @accentColor, lighten(@accentBaseColor,31%)) +@accentLinkColor = if(@accentColor, @accentColor, darken(@accentBaseColor,3%)) +@accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) +@accentSliderColor = if(@accentColor, @accentColor, lighten(saturate(@accentBaseColor,10%),6%)) +@accentUnderlineColor = if(@accentColor, @accentColor, tint(@accentBaseColor,10%)) +@accentButtonDefaultBorderColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #666 @@ -105,7 +106,7 @@ Button.default.foreground = @foreground Button.default.focusedBackground = $Button.focusedBackground Button.default.hoverBackground = darken($Button.default.background,3%,derived) Button.default.pressedBackground = darken($Button.default.background,10%,derived) -Button.default.borderColor = @accentCheckmarkColor +Button.default.borderColor = @accentButtonDefaultBorderColor Button.default.hoverBorderColor = $Button.hoverBorderColor Button.default.focusedBorderColor = $Button.focusedBorderColor Button.default.focusColor = $Component.focusColor @@ -251,8 +252,8 @@ PopupMenu.borderColor = #adadad ProgressBar.background = #D1D1D1 ProgressBar.foreground = @accentSliderColor -ProgressBar.selectionForeground = @textComponentBackground ProgressBar.selectionBackground = @foreground +ProgressBar.selectionForeground = contrast($ProgressBar.foreground,@foreground,@textComponentBackground) #---- RootPane ---- From e31e4dfe3a6f7f7f6634cc2cf3da4d072ab0a468 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Mon, 27 Sep 2021 12:31:49 +0200 Subject: [PATCH 10/12] Accent color: avoid that @accentXYZ variables depend on other @accentXYZ variables to allow independent modification (issue #233) --- .../resources/com/formdev/flatlaf/FlatDarkLaf.properties | 5 +++-- .../resources/com/formdev/flatlaf/FlatLightLaf.properties | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 7845d865..16742af2 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -53,12 +53,13 @@ # modify @accentBaseColor to use variations of accent base color @accentColor = null @accentBaseColor = #4B6EAF +@accentBase2Color = lighten(saturate(spin(@accentBaseColor,-8),13%),5%) # accent color variations @accentFocusColor = if(@accentColor, @accentColor, shade(spin(@accentBaseColor,-8),20%)) @accentLinkColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-5),50%),16%)) @accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) -@accentSliderColor = if(@accentColor, @accentColor, @accentUnderlineColor) -@accentUnderlineColor = if(@accentColor, @accentColor, lighten(saturate(spin(@accentBaseColor,-8),13%),5%)) +@accentSliderColor = if(@accentColor, @accentColor, @accentBase2Color) +@accentUnderlineColor = if(@accentColor, @accentColor, @accentBase2Color) @accentButtonDefaultBackground = if(@accentColor, @accentColor, darken(spin(@accentBaseColor,-8),13%)) # for buttons within components (e.g. combobox or spinner) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index 2bd0a9e5..525bb525 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -53,14 +53,15 @@ # modify @accentBaseColor to use variations of accent base color @accentColor = null @accentBaseColor = #2675BF +@accentBase2Color = lighten(saturate(@accentBaseColor,10%),6%) # accent color variations -@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) +@accentCheckmarkColor = if(@accentColor, @accentColor, tint(@accentBase2Color,20%)) @accentFocusColor = if(@accentColor, @accentColor, lighten(@accentBaseColor,31%)) @accentLinkColor = if(@accentColor, @accentColor, darken(@accentBaseColor,3%)) @accentSelectionBackground = if(@accentColor, @accentColor, @accentBaseColor) -@accentSliderColor = if(@accentColor, @accentColor, lighten(saturate(@accentBaseColor,10%),6%)) +@accentSliderColor = if(@accentColor, @accentColor, @accentBase2Color) @accentUnderlineColor = if(@accentColor, @accentColor, tint(@accentBaseColor,10%)) -@accentButtonDefaultBorderColor = if(@accentColor, @accentColor, tint(@accentSliderColor,20%)) +@accentButtonDefaultBorderColor = if(@accentColor, @accentColor, tint(@accentBase2Color,20%)) # for buttons within components (e.g. combobox or spinner) @buttonArrowColor = #666 From bb5c2eea10d9d290f69a8d305360a7af8cb551a0 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 28 Sep 2021 11:12:17 +0200 Subject: [PATCH 11/12] Accent color: - added `Component.accentColor` - dark themes: changed threshold for contrast() from 39% down to 25% for better readability of text - Demo: added "Default" accent color and changed "Blue" to lighter color (issue #233) --- .../resources/com/formdev/flatlaf/FlatDarkLaf.properties | 5 +++-- .../resources/com/formdev/flatlaf/FlatLightLaf.properties | 1 + .../src/main/java/com/formdev/flatlaf/demo/DemoFrame.java | 6 +++++- .../com/formdev/flatlaf/demo/FlatDarkLaf.properties | 6 ++++-- .../com/formdev/flatlaf/demo/FlatLightLaf.properties | 4 +++- flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt | 1 + flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt | 1 + .../com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt | 1 + 8 files changed, 19 insertions(+), 6 deletions(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 16742af2..8b44d38e 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -35,7 +35,7 @@ @background = #3c3f41 @foreground = #bbb @selectionBackground = @accentSelectionBackground -@selectionForeground = contrast(@selectionBackground,@background,@foreground,39%) +@selectionForeground = contrast(@selectionBackground,@background,@foreground,25%) @selectionInactiveBackground = spin(saturate(shade(@selectionBackground,70%),20%),-15) @selectionInactiveForeground = @foreground @disabledText = #888 @@ -164,6 +164,7 @@ Component.disabledBorderColor = $Component.borderColor Component.focusedBorderColor = lighten($Component.focusColor,5%) Component.focusColor = @accentFocusColor Component.linkColor = @accentLinkColor +Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor) Component.grayFilter = -20,-70,100 Component.error.borderColor = desaturate($Component.error.focusedBorderColor,25%) @@ -242,7 +243,7 @@ PopupMenu.borderColor = #5e5e5e ProgressBar.background = #555 ProgressBar.foreground = @accentSliderColor ProgressBar.selectionBackground = @foreground -ProgressBar.selectionForeground = contrast($ProgressBar.foreground,@background,@foreground,39%) +ProgressBar.selectionForeground = contrast($ProgressBar.foreground,@background,@foreground,25%) #---- RootPane ---- diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index 525bb525..ebc57e6b 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -171,6 +171,7 @@ Component.disabledBorderColor = lighten($Component.borderColor,4%) Component.focusedBorderColor = shade($Component.focusColor,10%) Component.focusColor = @accentFocusColor Component.linkColor = @accentLinkColor +Component.accentColor = if(@accentColor, @accentColor, @accentBaseColor) Component.grayFilter = 25,-25,100 Component.error.borderColor = lighten(desaturate($Component.error.focusedBorderColor,20%),25%) diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java index 22391701..be913508 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/DemoFrame.java @@ -336,9 +336,12 @@ class DemoFrame // flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties and // flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties private static String[] accentColorKeys = { - "Demo.accent.blue", "Demo.accent.purple", "Demo.accent.red", + "Demo.accent.default", "Demo.accent.blue", "Demo.accent.purple", "Demo.accent.red", "Demo.accent.orange", "Demo.accent.yellow", "Demo.accent.green", }; + private static String[] accentColorNames = { + "Default", "Blue", "Purple", "Red", "Orange", "Yellow", "Green", + }; private final JToggleButton[] accentColorButtons = new JToggleButton[accentColorKeys.length]; private JLabel accentColorLabel; @@ -351,6 +354,7 @@ class DemoFrame ButtonGroup group = new ButtonGroup(); for( int i = 0; i < accentColorButtons.length; i++ ) { accentColorButtons[i] = new JToggleButton( new AccentColorIcon( accentColorKeys[i] ) ); + accentColorButtons[i].setToolTipText( accentColorNames[i] ); accentColorButtons[i].addActionListener( this::accentColorChanged ); toolBar.add( accentColorButtons[i] ); group.add( accentColorButtons[i] ); diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties index e87ea1e1..16132ad6 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatDarkLaf.properties @@ -16,9 +16,11 @@ #---- Demo.accent ---- -Demo.accent.blue = #4B6EAF +# accent colors from https://github.com/89netraM/SystemColors/blob/master/src/net/asberg/macos/AccentColor.java +Demo.accent.default = #4B6EAF +Demo.accent.blue = #0A84FF Demo.accent.purple = #BF5AF2 -Demo.accent.red = #e81123 +Demo.accent.red = #FF453A Demo.accent.orange = #FF9F0A Demo.accent.yellow = #FFCC00 Demo.accent.green = #32D74B diff --git a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties index da420470..d004fb63 100644 --- a/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties +++ b/flatlaf-demo/src/main/resources/com/formdev/flatlaf/demo/FlatLightLaf.properties @@ -16,7 +16,9 @@ #---- Demo.accent ---- -Demo.accent.blue = #2675BF +# accent colors from https://github.com/89netraM/SystemColors/blob/master/src/net/asberg/macos/AccentColor.java +Demo.accent.default = #2675BF +Demo.accent.blue = #007AFF Demo.accent.purple = #BF5AF2 Demo.accent.red = #FF3B30 Demo.accent.orange = #FF9500 diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 84f7ac67..81391cd4 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -216,6 +216,7 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI #---- Component ---- +Component.accentColor #4b6eaf HSL 219 40 49 javax.swing.plaf.ColorUIResource [UI] Component.arc 5 Component.arrowType chevron Component.borderColor #646464 HSL 0 0 39 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index b4a7720e..b2546a32 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -220,6 +220,7 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI #---- Component ---- +Component.accentColor #2675bf HSL 209 67 45 javax.swing.plaf.ColorUIResource [UI] Component.arc 5 Component.arrowType chevron Component.borderColor #c4c4c4 HSL 0 0 77 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index c50e3328..c68d78ed 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -172,6 +172,7 @@ ComboBox.selectionBackground ComboBox.selectionForeground ComboBox.timeFactor ComboBoxUI +Component.accentColor Component.arc Component.arrowType Component.borderColor From b0edd5659f82e053d79e00555b2d0bebd9cbdcf3 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 28 Sep 2021 14:18:34 +0200 Subject: [PATCH 12/12] Accent color: made accent focus border colors lighter/darker in IntelliJ/Darcula themes (issue #233) --- .../resources/com/formdev/flatlaf/FlatDarculaLaf.properties | 6 ++++++ .../com/formdev/flatlaf/FlatIntelliJLaf.properties | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties index 2c3d196a..8d5c903a 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarculaLaf.properties @@ -31,6 +31,12 @@ # which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o. # See: https://github.com/JetBrains/intellij-community/ +#---- variables ---- + +# accent colors (blueish) +@accentFocusColor = if(@accentColor, darken(@accentColor,20%), shade(spin(@accentBaseColor,-8),20%)) + + #---- Button ---- Button.innerFocusWidth = 0 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index 2d3423fc..c2e8eb4b 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -34,7 +34,8 @@ #---- variables ---- # accent colors (blueish) -@accentButtonDefaultBackground = if(@accentColor, @accentColor, tint(@accentBaseColor,15%)) +@accentFocusColor = if(@accentColor, lighten(@accentColor,20%), lighten(@accentBaseColor,31%)) +@accentButtonDefaultBackground = if(@accentColor, @accentColor, tint(@accentBaseColor,15%)) #---- Button ----