This commit is contained in:
Radek Davidek 2026-01-20 16:26:59 +01:00
parent 0cfea69a50
commit acb1580e43
2 changed files with 4 additions and 4 deletions

View File

@ -42,12 +42,12 @@ public class ColoredFolderIcon implements Icon {
double luma = (0.299 * color.getRed() + 0.587 * color.getGreen() + 0.114 * color.getBlue()) / 255.0; double luma = (0.299 * color.getRed() + 0.587 * color.getGreen() + 0.114 * color.getBlue()) / 255.0;
g2.setColor(luma > 0.6 ? Color.BLACK : Color.WHITE); g2.setColor(luma > 0.6 ? Color.BLACK : Color.WHITE);
// Use a small font that fits inside the folder // Use a bold font that fits inside the folder
g2.setFont(new Font("SansSerif", Font.BOLD, 9)); g2.setFont(new Font("SansSerif", Font.BOLD, 10));
FontMetrics fm = g2.getFontMetrics(); FontMetrics fm = g2.getFontMetrics();
String firstLetter = label.substring(0, 1).toUpperCase(); String firstLetter = label.substring(0, 1).toUpperCase();
int lx = x + 2 + (12 - fm.stringWidth(firstLetter)) / 2; int lx = x + 2 + (12 - fm.stringWidth(firstLetter)) / 2;
int ly = y + 4 + (8 + fm.getAscent()) / 2 - 2; int ly = y + 4 + (8 + fm.getAscent()) / 2 - 1;
g2.drawString(firstLetter, lx, ly); g2.drawString(firstLetter, lx, ly);
} }

View File

@ -2114,7 +2114,7 @@ public class FilePanelTab extends JPanel {
icon = new UpArrowIcon(getForeground()); icon = new UpArrowIcon(getForeground());
} else if (item.isDirectory()) { } else if (item.isDirectory()) {
if (persistedConfig != null) { if (persistedConfig != null) {
icon = new ColoredFolderIcon(persistedConfig.getFolderColor(), item.getName()); icon = new ColoredFolderIcon(persistedConfig.getFolderColor());
} }
} else { } else {
// Use type-specific icon for files // Use type-specific icon for files