-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
On Windows, the query functionality also returns the same incorrect values. This is because the query functions for Windows return hardcoded values. The new Windows Terminal may soon support queries as discussed in microsoft/terminal#3718. In the meantime, it should be documented that the query functions return dummy values on Windows.
This can be tested with the following code:
package main
import (
"fmt"
"github.com/muesli/termenv"
)
func profileName(profile termenv.Profile) string {
switch profile {
case termenv.Ascii:
return "ASCII"
case termenv.ANSI:
return "ANSI"
case termenv.ANSI256:
return "ANSI256"
case termenv.TrueColor:
return "TrueColor"
default:
return "Unknown"
}
}
func main() {
fg := termenv.ForegroundColor()
fgRGB := termenv.ConvertToRGB(fg)
fgH, fgS, fgL := fgRGB.Hsl()
bg := termenv.BackgroundColor()
bgRGB := termenv.ConvertToRGB(bg)
bgH, bgS, bgL := bgRGB.Hsl()
fmt.Printf("Profile: %s\n", profileName(termenv.ColorProfile()))
fmt.Printf("HasDarkBackground: %v\n", termenv.HasDarkBackground())
fmt.Println()
fmt.Printf("ForegroundColor: %v\n", fg)
fmt.Printf("ForegroundColorRGB: (%f, %f, %f)\n", fgRGB.R, fgRGB.G, fgRGB.B)
fmt.Printf("ForegroundColorHSL: (%f, %f, %f)\n", fgH, fgS, fgL)
fmt.Println()
fmt.Printf("BackgroundColor: %v\n", bg)
fmt.Printf("BackgroundColorRGB: (%f, %f, %f)\n", bgRGB.R, bgRGB.G, bgRGB.B)
fmt.Printf("BackgroundColorHSL: (%f, %f, %f)\n", bgH, bgS, bgL)
}
Windows Terminal
Powershell in native Window
CMD
ajeetdsouza, leaanthony, erwin, djdv and ffalor
Metadata
Metadata
Assignees
Labels
No labels