-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit 778f681
Remove unneeded color-setting code in the boards and library manager
Previously, for the boards manager:
- InstallerJDialog would set the "selection background" color on the
table, using the "status.notice.bgcolor" the color (default blueish
green). This color is not used directly, but made available for cell
renderers to use.
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/ui/InstallerJDialog.java#L183
- For each cell, either a ContributedPlatformTableCellEditor or
ContributedPlatformTableCellRenderer is used, depending on whether
the cell is being edited (i.e. when selected).
- Both of these create a ContributedPlatformTableCellJPanel, and call
its `update` method, which creates the components for the cell.
- The `update` method als sets the background color of the description
to white, which does not actually have any effect because the
description is not opaque.
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java#L271
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java#L309
https://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#setBackground(java.awt.Color)
- The `update` method also sets its colors of itself (JPanel) to the FG
and BG color, or the selected FG and BG color of the table depending
on the selected status of the cell. These seem to default to black on
white for non-selected and white on blue-ish for selected cells.
However, InstallJDialog has replaced the selected BG with a blueish
green, as shown above.
Of these, only the BG colors actually seem to take effect. The fg
color of the description component is actually used (default black).
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java#L282-L288
- After calling `update`, ContributedPlatformTableCellEditor overrides
the JPanel background color with a fixed grey color. Similarly,
ContributedPlatformTableCellRenderer sets an alternating white and
(slightly lighter) grey background color. Together, this means that
the background color set by ContributedPlatformTableCellJPanel is
never actually used.
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java#L132-L133
https://github.com/arduino/Arduino/blob/a1448876a1115c9d3ee9e88f29a15bb081a27816/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellRenderer.java#L47-L53
For the library manager, pretty much the same happens.
Effectively, the only colors that were actually used were the background
colors set by ContributedPlatformTableCellEditor and
ContributedPlatformTableCellRenderer. This is problematic because:
- There is a lot of other confusing and unused code
- The foreground color is never set. This is fine when it is black or
another dark color, but when the system is configured with a dark
theme, the default foreground color will be white, which is
problematic on a white background.
This commit remove the unneeded code, setting the foreground color
is left for later. It also removes the (now unused) `isSelected` from
`ContributedPlatformTableCellJPanel::update`. For the library manager,
the corresponding argument is still used to decide the "author" color.1 parent b4bcb30 commit 778f681
File tree
5 files changed
+3
-23
lines changed- app/src/cc/arduino/contributions
- libraries/ui
- packages/ui
- ui
5 files changed
+3
-23
lines changedLines changed: 0 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
202 | - | ||
203 | 202 |
| |
204 | 203 |
| |
205 | 204 |
| |
| |||
209 | 208 |
| |
210 | 209 |
| |
211 | 210 |
| |
212 | - | ||
213 | - | ||
214 | - | ||
215 | - | ||
216 | - | ||
217 | - | ||
218 | - | ||
219 | - | ||
220 | 211 |
| |
221 | 212 |
| |
222 | 213 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
132 | - | ||
132 | + | ||
133 | 133 |
| |
134 | 134 |
| |
135 | 135 |
| |
|
Lines changed: 1 addition & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 | - | ||
179 | - | ||
178 | + | ||
180 | 179 |
| |
181 | 180 |
| |
182 | 181 |
| |
| |||
262 | 261 |
| |
263 | 262 |
| |
264 | 263 |
| |
265 | - | ||
266 | 264 |
| |
267 | 265 |
| |
268 | 266 |
| |
| |||
272 | 270 |
| |
273 | 271 |
| |
274 | 272 |
| |
275 | - | ||
276 | - | ||
277 | - | ||
278 | - | ||
279 | - | ||
280 | - | ||
281 | - | ||
282 | - | ||
283 | 273 |
| |
284 | 274 |
| |
285 | 275 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 | - | ||
47 | + | ||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
180 | 180 |
| |
181 | 181 |
| |
182 | 182 |
| |
183 | - | ||
184 | 183 |
| |
185 | 184 |
| |
186 | 185 |
| |
|
0 commit comments