diff options
-rw-r--r-- | tui/actions.go | 4 | ||||
-rw-r--r-- | tui/format.go | 40 | ||||
-rw-r--r-- | tui/show.go | 12 |
3 files changed, 34 insertions, 22 deletions
diff --git a/tui/actions.go b/tui/actions.go index 92347e7..215e052 100644 --- a/tui/actions.go +++ b/tui/actions.go @@ -339,9 +339,9 @@ func (ui *UI) showInfo() { selectedFile := ui.table.GetCell(row, column).GetReference().(fs.Item) if ui.UseColors { - numberColor = "[#e67100::b]" + numberColor = orangeBold } else { - numberColor = "[::b]" + numberColor = defaultColorBold } linesCount := 12 diff --git a/tui/format.go b/tui/format.go index 84ad967..001c004 100644 --- a/tui/format.go +++ b/tui/format.go @@ -9,6 +9,18 @@ import ( "github.com/rivo/tview" ) +const ( + blackOnWhite = "[black:white:-]" + blackOnBlue = "[#000000:#2479d0:-]" + whiteOnBlack = "[white:black:-]" + + orangeBold = "[#e67100::b]" + blueBold = "[#3498db::b]" + + defaultColor = "[-::]" + defaultColorBold = "[::b]" +) + func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, ignored bool) string { var part int @@ -23,9 +35,9 @@ func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, row := string(item.GetFlag()) if ui.UseColors && !marked && !ignored { - row += "[#e67100::b]" + row += orangeBold } else { - row += "[::b]" + row += defaultColorBold } if ui.ShowApparentSize { @@ -42,21 +54,21 @@ func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, if ui.showItemCount { if ui.UseColors && !marked && !ignored { - row += "[#e67100::b]" + row += orangeBold } else { - row += "[::b]" + row += defaultColorBold } row += fmt.Sprintf("%11s ", ui.formatCount(item.GetItemCount())) } if ui.showMtime { if ui.UseColors && !marked && !ignored { - row += "[#e67100::b]" + row += orangeBold } else { - row += "[::b]" + row += defaultColorBold } row += fmt.Sprintf( - "%s [-::]", + "%s "+defaultColor, item.GetMtime().Format("2006-01-02 15:04:05"), ) } @@ -72,9 +84,9 @@ func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, if item.IsDir() { if ui.UseColors && !marked && !ignored { - row += "[#3498db::b]/" + row += blueBold + "/" } else { - row += "[::b]/" + row += defaultColorBold + "/" } } row += tview.Escape(item.GetName()) @@ -85,15 +97,15 @@ func (ui *UI) formatSize(size int64, reverseColor bool, transparentBg bool) stri var color string if reverseColor { if ui.UseColors { - color = "[#000000:#2479d0:-]" + color = blackOnBlue } else { - color = "[black:white:-]" + color = blackOnWhite } } else { if transparentBg { - color = "[-::]" + color = defaultColor } else { - color = "[white:black:-]" + color = whiteOnBlack } } @@ -105,7 +117,7 @@ func (ui *UI) formatSize(size int64, reverseColor bool, transparentBg bool) stri func (ui *UI) formatCount(count int) string { row := "" - color := "[-::]" + color := defaultColor count64 := float64(count) switch { diff --git a/tui/show.go b/tui/show.go index 0beeeff..e194f48 100644 --- a/tui/show.go +++ b/tui/show.go @@ -147,10 +147,10 @@ func (ui *UI) showDir() { var footerNumberColor, footerTextColor string if ui.UseColors { footerNumberColor = "[#ffffff:#2479d0:b]" - footerTextColor = "[#000000:#2479d0:-]" + footerTextColor = blackOnBlue } else { footerNumberColor = "[black:white:b]" - footerTextColor = "[black:white:-]" + footerTextColor = blackOnWhite } selected := "" @@ -214,10 +214,10 @@ func (ui *UI) showDevices() { var footerNumberColor, footerTextColor string if ui.UseColors { footerNumberColor = "[#ffffff:#2479d0:b]" - footerTextColor = "[#000000:#2479d0:-]" + footerTextColor = blackOnBlue } else { footerNumberColor = "[black:white:b]" - footerTextColor = "[black:white:-]" + footerTextColor = blackOnWhite } ui.footerLabel.SetText( @@ -297,8 +297,8 @@ func (ui *UI) formatHelpTextFor() string { for i, line := range lines { if ui.UseColors { lines[i] = strings.ReplaceAll( - strings.ReplaceAll(line, "[::b]", "[red]"), - "[white:black:-]", + strings.ReplaceAll(line, defaultColorBold, "[red]"), + whiteOnBlack, "[white]", ) } |