Color directories that cannot be opened gray.

This commit is contained in:
Florian Nücke
2022-01-07 12:50:07 +01:00
parent c392ad0f90
commit 99fa59cfc6

View File

@@ -352,9 +352,12 @@ public final class FileChooserScreen extends Screen {
return createDirectoryEntry(path, path.getFileName().toString() + path.getFileSystem().getSeparator());
}
private FileList.FileEntry createDirectoryEntry(final Path path, final String displayName) {
private FileList.FileEntry createDirectoryEntry(@Nullable final Path path, final String displayName) {
final TextColor color = path != null && Files.exists(path)
? TextColor.fromRgb(0xA0A0FF)
: TextColor.fromLegacyFormat(ChatFormatting.GRAY);
return new FileList.FileEntry(path, new TextComponent(displayName)
.withStyle(s -> s.withColor(TextColor.fromRgb(0xA0A0FF))));
.withStyle(s -> s.withColor(color)));
}
private final class FileEntry extends ObjectSelectionList.Entry<FileEntry> {