Merge pull request #17 from Ortiye/master

Fix colors
This commit is contained in:
Yash Handa
2020-12-28 19:19:50 +05:30
committed by GitHub
3 changed files with 8 additions and 8 deletions
+3 -3
View File
@@ -174,11 +174,11 @@ func (w *CTW) printCell(buf *bytes.Buffer, i int, cs [4]int) {
fmt.Fprintf(buf, "%-*s%s", cs[0]-1, w.d[i][0], brailEmpty)
}
if w.showIcon {
fmt.Fprintf(buf, "%s%1s%s%s", w.ic[i], w.d[i][1], white, brailEmpty)
fmt.Fprintf(buf, "%s%1s%s%s", w.ic[i], w.d[i][1], noColor, brailEmpty)
}
fmt.Fprintf(buf, "%s%-*s%s", getGitColor(w.d[i][3]), cs[2], w.d[i][2], white)
fmt.Fprintf(buf, "%s%-*s%s", getGitColor(w.d[i][3]), cs[2], w.d[i][2], noColor)
if cs[3] > 0 {
fmt.Fprintf(buf, "%s%s%1s%s", brailEmpty, getGitColor(w.d[i][3]), w.d[i][3], white)
fmt.Fprintf(buf, "%s%s%1s%s", brailEmpty, getGitColor(w.d[i][3]), w.d[i][3], noColor)
}
}
+2 -2
View File
@@ -64,10 +64,10 @@ func (l *LongCTW) Flush(buf *bytes.Buffer) {
}
if j == l.cols-2 {
fmt.Fprintf(buf, "%s%*s%s", l.ic[i], l.c[j], c, white)
fmt.Fprintf(buf, "%s%*s%s", l.ic[i], l.c[j], c, noColor)
} else if j >= l.cols-1 && (1<<l.cols)&skipCol == 0 {
color := getGitColor(r[l.cols])
fmt.Fprintf(buf, "%s%-*s%s", color, l.c[j], c, white)
fmt.Fprintf(buf, "%s%-*s%s", color, l.c[j], c, noColor)
} else {
fmt.Fprintf(buf, "%-*s", l.c[j], c)
}
+3 -3
View File
@@ -3,7 +3,7 @@ package ctw
import "strings"
var (
white string = "\033[38;2;255;255;255m"
noColor string = "\033[0m"
green string = "\033[38;2;055;183;021m"
brown string = "\033[38;2;192;154;107m"
brailEmpty string = "\u2800"
@@ -11,7 +11,7 @@ var (
func DisplayColor(b bool) {
if b == false {
white = ""
noColor = ""
green = ""
brown = ""
}
@@ -26,7 +26,7 @@ func DisplayBrailEmpty(b bool) {
func getGitColor(gitStatus string) string {
switch strings.Trim(gitStatus, " ") {
case "":
return white
return noColor
case "U":
return green
default: