Skip to content

Commit

Permalink
feat: new icons
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakenelf committed May 19, 2024
1 parent 3e1f6b9 commit ab09098
Show file tree
Hide file tree
Showing 4 changed files with 443 additions and 532 deletions.
58 changes: 36 additions & 22 deletions filetree/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,64 @@ func (m Model) View() string {
case m.Disabled:
fallthrough
case i == m.Cursor && !m.Disabled:
iconColor := m.inactiveItemColor
textColor := m.inactiveItemColor

if i == m.Cursor && !m.Disabled {
iconColor = m.selectedItemColor
textColor = m.selectedItemColor
}

if m.showIcons {
icon := icons.Icons.GetIcon(file.FileInfo)
icon := icons.GetElementIcon(file.Name, file.IsDirectory)

fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(icon.Icon) + " ",
)

fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(iconColor).
Render(icon) + " ",
Foreground(textColor).
Render(file.Name) + "\n",
)
} else {
fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(file.Name) + "\n",
)
}

fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(file.Name) + "\n",
)
case i != m.Cursor && !m.Disabled:
iconColor := m.unselectedItemColor
textColor := m.unselectedItemColor

if m.showIcons {
icon := icons.Icons.GetIcon(file.FileInfo)
icon := icons.GetElementIcon(file.Name, file.IsDirectory)

fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(iconColor).
Render(icon) + " ",
Foreground(lipgloss.Color(icon.Color)).
Render(icon.Icon) + " ",
)
}

fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(file.Name) + "\n",
)
fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(file.Name) + "\n",
)
} else {
fileList.WriteString(
lipgloss.NewStyle().
Bold(true).
Foreground(textColor).
Render(file.Name) + "\n",
)
}
}
}

Expand Down
Loading

0 comments on commit ab09098

Please sign in to comment.