Skip to content

[tui] --no-color flag is ignored by the interactive TUI #13

Description

@tiankaima

Summary

--no-color disables color for plain table output but not for the interactive search-table TUI (catalog course / catalog section / catalog teacher), which keeps emitting full ANSI color.

Reproduction

life-ustc --no-color --server <server> catalog course

Captured with tmux capture-pane -e (escape sequences visible): the TUI still emits ESC[38;5;62m (border), ESC[38;5;42m (title), ESC[38;5;244m (muted), ESC[38;5;230mESC[48;5;62m (selected row). Full capture: /tmp/tui-results-nocolor-80x24.txt.

Root cause

internal/cmd/root/root.go:124-126 only sets color.NoColor = true (fatih/color). The TUI (internal/tui/tui.go, styles at lines 643-661) uses lipgloss/bubbletea, which are never told about the flag — RunSearchTable (tui.go:69) starts the program with no renderer/color-profile option.

Suggested fix

When output.Current.NoColor is set, also disable lipgloss color before starting the program, e.g. lipgloss.SetColorProfile(termenv.Ascii) in RunSearchTable, or thread a no-color option through SearchTable. This matters for accessibility, terminals with broken color, and users who set NO_COLOR/--no-color expecting a monochrome UI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions