Skip to content

Commit

Permalink
fix#22 no color output on TERM equals to alacritty
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Aug 25, 2020
1 parent fa6a6f0 commit 41d6512
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go_version: [1.11, 1.12, 1.13, 1.14]
go_version: [1.11, 1.12, 1.13, 1.14, 1.15]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -9,6 +9,7 @@ go:
- '1.12'
- '1.13'
- '1.14'
- '1.15'

before_install:
- go get github.com/mattn/goveralls
Expand Down
12 changes: 10 additions & 2 deletions utils.go
Expand Up @@ -20,6 +20,7 @@ import (
// Don't support color:
// "TERM=cygwin"
var specialColorTerms = map[string]bool{
"alacritty": true,
"screen-256color": true,
"tmux-256color": true,
"rxvt-unicode-256color": true,
Expand Down Expand Up @@ -75,7 +76,8 @@ func IsSupportColor() bool {
return true
}

return false
// up: if support 256-color, can also support basic color.
return IsSupport256Color()
}

// IsSupport256Color render
Expand All @@ -84,7 +86,13 @@ func IsSupport256Color() bool {
// "TERM=screen-256color"
// "TERM=tmux-256color"
// "TERM=rxvt-unicode-256color"
return strings.Contains(os.Getenv("TERM"), "256color")
supported := strings.Contains(os.Getenv("TERM"), "256color")
if !supported {
// up: if support true-color, can also support 256-color.
supported = IsSupportTrueColor()
}

return supported
}

// IsSupportTrueColor render. IsSupportRGBColor
Expand Down

0 comments on commit 41d6512

Please sign in to comment.