Skip to content

Commit 6d92f67

Browse files
Set foreground color on board/library titles in managers
In commit 93581b0 (Set foreground color in library/board manager), the foreground color was set in addition to the background color, to make sure that the library and board manager would remain readable even with a non-standard color scheme (e.g. a dark theme). When that commit was created, this worked properly. However, between creating that commit and merging it as part of arduino#9272, the title rendering was changed from being part of the description (which had its color set up properly) to being part of the title border (which used default colors) in arduino#9262. This commit fixes this again by applying the foreground color also to the TitledBorder component.
1 parent 511106b commit 6d92f67

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class ContributedLibraryTableCellJPanel extends JPanel {
3434
final JPanel inactiveButtonsPanel;
3535
final JLabel statusLabel;
3636
final JTextPane description;
37+
final TitledBorder titledBorder;
3738
private final String moreInfoLbl = tr("More info");
3839

3940
public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
@@ -120,7 +121,7 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value,
120121
return;
121122

122123
ContributedLibrary selected = releases.getSelected();
123-
TitledBorder titledBorder = BorderFactory.createTitledBorder(selected.getName());
124+
titledBorder = BorderFactory.createTitledBorder(selected.getName());
124125
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
125126
setBorder(titledBorder);
126127
Optional<ContributedLibrary> mayInstalled = releases.getInstalled();
@@ -271,5 +272,7 @@ public void setForeground(Color c) {
271272
// The description is not opaque, so copy our foreground color to it.
272273
if (description != null)
273274
description.setForeground(c);
275+
if (titledBorder != null)
276+
titledBorder.setTitleColor(c);
274277
}
275278
}

app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class ContributedPlatformTableCellJPanel extends JPanel {
6767
final JPanel inactiveButtonsPanel;
6868
final JLabel statusLabel;
6969
final JTextPane description;
70+
final TitledBorder titledBorder;
7071
private final String moreInfoLbl = tr("More Info");
7172
private final String onlineHelpLbl = tr("Online Help");
7273

@@ -186,7 +187,7 @@ void update(JTable parentTable, Object value, boolean hasBuiltInRelease) {
186187
}
187188

188189
ContributedPlatform selected = releases.getSelected();
189-
TitledBorder titledBorder = BorderFactory.createTitledBorder(selected.getName());
190+
titledBorder = BorderFactory.createTitledBorder(selected.getName());
190191
titledBorder.setTitleFont(getFont().deriveFont(Font.BOLD));
191192
setBorder(titledBorder);
192193
ContributedPlatform installed = releases.getInstalled();
@@ -311,5 +312,7 @@ public void setForeground(Color c) {
311312
// The description is not opaque, so copy our foreground color to it.
312313
if (description != null)
313314
description.setForeground(c);
315+
if (titledBorder != null)
316+
titledBorder.setTitleColor(c);
314317
}
315318
}

0 commit comments

Comments
 (0)