This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push:
new 474636cccf Make Options category buttons accent colour aware in
FlatLaf.
new 1f231392fb Merge pull request #5867 from
neilcsmith-net/flatlaf-options-fix
474636cccf is described below
commit 474636cccf62e539704e53dd21bc05d42c89f926
Author: Neil C Smith <[email protected]>
AuthorDate: Fri Apr 21 14:57:25 2023 +0100
Make Options category buttons accent colour aware in FlatLaf.
Adds optional highlight and selection foreground UI keys in OptionsPanel.
Updates FlatLaf to use derived colours for all option button colours.
Fixes issue with illegible foreground text in selected option category and
default settings.
---
.../swing/laf/flatlaf/FlatDarkLaf.properties | 6 ----
.../netbeans/swing/laf/flatlaf/FlatLaf.properties | 5 +++
.../swing/laf/flatlaf/FlatLightLaf.properties | 6 ----
.../org/netbeans/modules/options/OptionsPanel.java | 39 ++++++++++++++++++++--
4 files changed, 42 insertions(+), 14 deletions(-)
diff --git
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
index c5b28b468e..9e2fe686ff 100644
---
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
+++
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatDarkLaf.properties
@@ -192,9 +192,3 @@ Nb.browser.picker.foreground.light=rgb(192,192,192)
# search in projects
nb.search.sandbox.highlight=@selectionBackground
nb.search.sandbox.regexp.wrong=rgb(255, 71, 71)
-
-
-#---- OptionsPanel ----
-
-nb.options.categories.selectionBackground = @selectionBackground
-nb.options.categories.highlightBackground = $TabbedPane.hoverColor
diff --git
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
index 7305879a94..fe3ced48fa 100644
---
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
+++
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLaf.properties
@@ -165,6 +165,11 @@
Nb.MainWindow.Toolbar.Dragger=org.netbeans.swing.laf.flatlaf.ui.FlatToolbarDragg
#---- OptionsPanel ----
nb.options.categories.tabPanelForeground = @foreground
+nb.options.categories.tabPanelBackground = @background
+nb.options.categories.selectionForeground = @selectionForeground
+nb.options.categories.selectionBackground = @selectionBackground
+nb.options.categories.highlightForeground = @selectionInactiveForeground
+nb.options.categories.highlightBackground = @selectionInactiveBackground
nb.options.categories.separatorColor = $Separator.foreground
nb.options.categories.selectionBorderColor =
$nb.options.categories.selectionBackground
nb.options.categories.highlightBorderColor =
$nb.options.categories.highlightBackground
diff --git
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLightLaf.properties
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLightLaf.properties
index 234ece4f51..95606044b9 100644
---
a/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLightLaf.properties
+++
b/platform/o.n.swing.laf.flatlaf/src/org/netbeans/swing/laf/flatlaf/FlatLightLaf.properties
@@ -80,9 +80,3 @@ nb.quicksearch.border=1,1,1,1,@background
# output
nb.output.selectionBackground=#89BCED
-
-
-#---- OptionsPanel ----
-
-nb.options.categories.selectionBackground = rgb(193, 210, 238)
-nb.options.categories.highlightBackground = rgb(224, 232, 246)
diff --git
a/platform/options.api/src/org/netbeans/modules/options/OptionsPanel.java
b/platform/options.api/src/org/netbeans/modules/options/OptionsPanel.java
index 4aa86be09f..15f0d34dfe 100644
--- a/platform/options.api/src/org/netbeans/modules/options/OptionsPanel.java
+++ b/platform/options.api/src/org/netbeans/modules/options/OptionsPanel.java
@@ -1008,6 +1008,22 @@ public class OptionsPanel extends JPanel {
return new Color (193, 210, 238);
}
+ private Color getSelectionForeground() {
+ Color uiColor =
UIManager.getColor("nb.options.categories.selectionForeground"); //NOI18N
+ if (uiColor != null) {
+ return uiColor;
+ }
+
+ if ( useUIDefaultsColors() ) {
+ Color res = UIManager.getColor("Tree.selectionForeground");
//NOI18N
+ if (null == res) {
+ return new Color(res.getRGB());
+ }
+ }
+
+ return getTabPanelForeground();
+ }
+
private Color getHighlightBackground() {
Color uiColor =
UIManager.getColor("nb.options.categories.highlightBackground"); //NOI18N
if (uiColor != null) {
@@ -1025,6 +1041,24 @@ public class OptionsPanel extends JPanel {
return new Color (224, 232, 246);
}
+ private Color getHighlightForeground() {
+ Color uiColor =
UIManager.getColor("nb.options.categories.highlightForeground"); //NOI18N
+ if (uiColor != null) {
+ return uiColor;
+ }
+
+ if( useUIDefaultsColors() ) {
+ if( !Color.white.equals( getTabPanelBackground() ) ) {
+ Color res = UIManager.getColor( "Tree.selectionForeground" );
//NOI18N
+ if( null == res )
+ res = Color.blue;
+ return new Color( res.getRGB() );
+ }
+ }
+
+ return getTabPanelForeground();
+ }
+
/**
* Get if Options Panel uses UI default colors.
* Use property nb.options.useUIDefaultsColors to use modify it.
@@ -1190,7 +1224,7 @@ public class OptionsPanel extends JPanel {
));
}
setBackground(selected);
- setForeground(getUIColorOrDefault("MenuItem.selectionForeground",
getTabPanelForeground()));
+ setForeground(getSelectionForeground());
}
void setHighlighted() {
@@ -1203,7 +1237,7 @@ public class OptionsPanel extends JPanel {
new EmptyBorder(0, 2, 0, 2)
));
setBackground(highlighted);
- setForeground(getTabPanelForeground());
+ setForeground(getHighlightForeground());
}
if (!category.isHighlited()) {
if (categoryModel.getHighlitedCategoryID() != null) {
@@ -1323,6 +1357,7 @@ public class OptionsPanel extends JPanel {
@Override
void setNormal() {
+ super.setNormal();
setBorder(normalBorder);
status = STATUS_NORMAL;
repaint();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists