Skip to content

Commit 003a84f

Browse files
authored
Merge pull request #59 from lukepistrol/main
Filetype specific icon colors
2 parents fadcc84 + e0d7dd3 commit 003a84f

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

CodeEdit/Breadcrumbs/BreadcrumbsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct BreadcrumbsView: View {
3434
BreadcrumbsComponent(folder, systemImage: "folder.fill")
3535
chevron
3636
}
37-
BreadcrumbsComponent(fileName, systemImage: fileImage, color: .accentColor)
37+
BreadcrumbsComponent(fileName, systemImage: fileImage, color: file.iconColor)
3838
}
3939
.padding(.leading, 12)
4040
}

CodeEdit/SideBar/SideBarItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct SideBarItem: View {
3636
}
3737
} label: {
3838
Label(item.url.lastPathComponent, systemImage: item.systemImage)
39-
.tint(.accentColor)
39+
.accentColor(item.iconColor)
4040
.font(.callout)
4141
}
4242
}

CodeEditModules/Modules/WorkspaceClient/src/Model/FileItem.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import SwiftUI
910

1011
public extension WorkspaceClient {
1112
struct FileItem: Hashable, Identifiable, Comparable {
@@ -45,7 +46,9 @@ public extension WorkspaceClient {
4546
return "square.fill.on.circle.fill"
4647
case "entitlements":
4748
return "checkmark.seal"
48-
case "md", "txt", "rtf", "plist":
49+
case "plist":
50+
return "tablecells"
51+
case "md", "txt", "rtf":
4952
return "doc.plaintext"
5053
case "html", "py", "sh":
5154
return "chevron.left.forwardslash.chevron.right"
@@ -58,6 +61,23 @@ public extension WorkspaceClient {
5861
}
5962
}
6063

64+
public var iconColor: Color {
65+
switch fileType {
66+
case "swift", "html":
67+
return .orange
68+
case "java":
69+
return .red
70+
case "js", "entitlements", "json", "LICENSE":
71+
return .yellow
72+
case "css", "ts", "jsx", "md", "py":
73+
return .blue
74+
case "sh":
75+
return .green
76+
default:
77+
return .blue
78+
}
79+
}
80+
6181
private var fileType: String {
6282
url.lastPathComponent.components(separatedBy: ".").last ?? ""
6383
}

0 commit comments

Comments
 (0)