Skip to content

Color detection error in WSL in Windows Terminal #124

Open
@meowgorithm

Description

@meowgorithm

This could be user error, but I'm noticing that, while termenv will correctly detect TrueColor in Windows Terminal, it incorrectly detects ANSI256, in WSL.

Given this code...

package main

import (
        "fmt"

        "github.com/muesli/termenv"
)

func main() {
        p := func() string {
                switch termenv.ColorProfile() {
                case termenv.TrueColor:
                        return "TrueColor"
                case termenv.ANSI256:
                        return "ANSI256"
                case termenv.ANSI:
                        return "ANSI"
                case termenv.Ascii:
                        return "Ascii"
                default:
                        return "(Undetected)"
                }
        }()

        fmt.Printf("Termenv detected profile: %s\n", p)
}

...I get the following output. The first line shows example.exe running in PowerShell and then in WSL.

Screenshot 2023-03-10 105403

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions