feat: NO_COLOR env to not use ansi colors in miro

This commit is contained in:
2026-03-21 06:48:23 +00:00
parent 7b61da612a
commit b3fc15d3ae
4 changed files with 71 additions and 8 deletions
+10 -4
View File
@@ -21,9 +21,6 @@ var (
pass: 0x7bf1a8,
fail: 0xff8fa3,
}
chevron = NewStyle().FG(palette.chevronTeal).Bold().Italic().Apply("")
prefix = NewStyle().FG(palette.miroGreen).Bold().Italic().Apply("miro") + " " + chevron + " "
)
func label(text string, color uint32) string {
@@ -42,10 +39,19 @@ func LabelInfo(text string) string {
return label(text, palette.info)
}
func noColor() bool {
return os.Getenv("NO_COLOR") != ""
}
func prefix() string {
chevron := NewStyle().FG(palette.chevronTeal).Bold().Italic().Apply("")
return NewStyle().FG(palette.miroGreen).Bold().Italic().Apply("miro") + " " + chevron + " "
}
func Format(msg string) string {
body := strings.TrimRight(msg, "\n")
suffix := msg[len(body):]
return prefix + body + suffix
return prefix() + body + suffix
}
func Println(msg string) {