Skip to content

Commit

Permalink
Merge pull request #331 from pterm/330-use-fallback-style-when-using-…
Browse files Browse the repository at this point in the history
…rgb-in-an-unsupported-terminal-on-bigtextprinter
  • Loading branch information
MarvinJWendt committed Mar 18, 2022
2 parents 6e950d6 + a99d307 commit 2bfb950
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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") != ""
}

0 comments on commit 2bfb950

Please sign in to comment.