为终端应用程序提供高级 ANSI 样式和颜色支持
termenv 会查询终端所运行的功能,因此您可以安全地使用高级功能,如 RGB 颜色或 ANSI 样式。output.Profile 返回支持的配置:
// Returns terminal's foreground color
color := output.ForegroundColor()
// Returns terminal's background color
color := output.BackgroundColor()
// Returns whether terminal uses a dark-ish background
darkTheme := output.HasDarkBackground()
``` ### 手动选择配置文件 如果您不想依赖自动检测,可以手动选择要使用的配置文件:
<a href="https://github.com/muesli/termenv/releases"></a>
<a href="https://godoc.org/github.com/muesli/termenv"></a>
<a href="https://github.com/muesli/termenv/actions"></a>
<a href="https://coveralls.io/github/muesli/termenv?branch=master"></a>
<a href="https://goreportcard.com/report/muesli/termenv"></a>暂无开放 Issues,或尚未同步最近议题。