Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use fallback color in BigTextPrinter when RGB is not supported #331

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion bigtext_printer.go
@@ -1,6 +1,7 @@
package pterm

import (
"github.com/gookit/color"
"strings"

"github.com/mattn/go-runewidth"
Expand Down Expand Up @@ -141,7 +142,7 @@ func (p BigTextPrinter) Srender() (string, error) {
letterLine += strings.Repeat(" ", maxLetterWidth-letterLineLength)
}

if letter.RGB != (RGB{}) {
if letter.RGB != (RGB{}) && (color.IsSupportRGBColor() || internal.RunsInCi()) {
ret += letter.RGB.Sprint(letterLine)
} else {
ret += letter.Style.Sprint(letterLine)
Expand Down
8 changes: 8 additions & 0 deletions internal/utils.go
@@ -0,0 +1,8 @@
package internal

import "os"

// RunsInCi returns true if the current build is running on a CI server.
func RunsInCi() bool {
return os.Getenv("CI") != ""
}