1
1
mirror of https://github.com/walles/moar.git synced 2024-08-17 07:50:35 +03:00

Use 24-bit color if COLORTERM=truecolor is in the environment

This commit is contained in:
Wallunen 2024-02-10 02:56:00 +02:00
parent 1043d3feb7
commit e5a600b51d
No known key found for this signature in database
GPG Key ID: BBC8F5F3EBF5E63B
2 changed files with 2 additions and 2 deletions

View File

@ -304,7 +304,7 @@ func parseStyleOption(styleOption string) (*chroma.Style, error) {
func parseColorsOption(colorsOption string) (twin.ColorType, error) {
if strings.ToLower(colorsOption) == "auto" {
colorsOption = "16M"
if strings.Contains(os.Getenv("TERM"), "256") {
if os.Getenv("COLORTERM") != "truecolor" && strings.Contains(os.Getenv("TERM"), "256") {
// Covers "xterm-256color" as used by the macOS Terminal
colorsOption = "256"
}

View File

@ -113,7 +113,7 @@ func NewScreen() (Screen, error) {
func NewScreenWithMouseMode(mouseMode MouseMode) (Screen, error) {
terminalColorCount := ColorType24bit
if strings.Contains(os.Getenv("TERM"), "256") {
if os.Getenv("COLORTERM") != "truecolor" && strings.Contains(os.Getenv("TERM"), "256") {
// Covers "xterm-256color" as used by the macOS Terminal
terminalColorCount = ColorType256
}