1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-29 22:48:24 +02:00

standardise how we handle background colours

This commit is contained in:
Jesse Duffield
2020-05-13 21:10:00 +10:00
parent d5db02a899
commit 267730bc00
6 changed files with 45 additions and 12 deletions

View File

@@ -28,9 +28,6 @@ func getFileDisplayStrings(f *commands.File, diffed bool) []string {
return []string{red.Sprint(f.DisplayString)}
}
output := green.Sprint(f.DisplayString[0:1])
output += red.Sprint(f.DisplayString[1:3])
var restColor *color.Color
if diffed {
restColor = diffColor
@@ -39,6 +36,22 @@ func getFileDisplayStrings(f *commands.File, diffed bool) []string {
} else {
restColor = green
}
output += restColor.Sprint(f.Name)
// this is just making things look nice when the background attribute is 'reverse'
firstChar := f.DisplayString[0:1]
firstCharCl := green
if firstChar == " " {
firstCharCl = restColor
}
secondChar := f.DisplayString[1:2]
secondCharCl := red
if secondChar == " " {
secondCharCl = restColor
}
output := firstCharCl.Sprint(firstChar)
output += secondCharCl.Sprint(secondChar)
output += restColor.Sprintf(" %s", f.Name)
return []string{output}
}