feat: auto-detect non-TTY and adjust output (bd-xrwy)
Add TTY detection to automatically disable ANSI colors when stdout is piped or redirected. Respects standard conventions: - NO_COLOR environment variable (no-color.org) - CLICOLOR=0 disables color - CLICOLOR_FORCE enables color even in non-TTY Also adds ShouldUseEmoji() helper controlled by BD_NO_EMOJI. Pager already disabled non-TTY in previous work (bd-jdz3). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,16 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/muesli/termenv"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Disable colors when not appropriate (non-TTY, NO_COLOR, etc.)
|
||||
if !ShouldUseColor() {
|
||||
lipgloss.SetColorProfile(termenv.Ascii)
|
||||
}
|
||||
}
|
||||
|
||||
// Ayu theme color palette
|
||||
// Dark: https://terminalcolors.com/themes/ayu/dark/
|
||||
// Light: https://terminalcolors.com/themes/ayu/light/
|
||||
|
||||
Reference in New Issue
Block a user