Skip to content

feat(cli): add styled output with theme-aware colors#278

Merged
echobt merged 1 commit intomasterfrom
feat/styled-cli-output
Jan 27, 2026
Merged

feat(cli): add styled output with theme-aware colors#278
echobt merged 1 commit intomasterfrom
feat/styled-cli-output

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 27, 2026

Summary

This PR adds a new styled_output module that provides human-friendly, colorful CLI messages that automatically adapt to the terminal theme and respect the NO_COLOR environment variable.

Changes

New Module: styled_output.rs

  • Provides print_success, print_error, print_warning, print_info, and print_dim functions
  • Messages use themed colors that adapt to light/dark terminal backgrounds:
    • Success: green (✓ icon)
    • Error: red (✗ icon)
    • Warning: amber (⚠ icon)
    • Info: blue (ℹ icon)
    • Dim: gray (· icon)
  • Automatically detects terminal theme via:
    • COLORFGBG environment variable
    • ITERM_PROFILE environment variable
  • Respects NO_COLOR environment variable
  • Includes format functions that return strings without printing

Updated Files

  • login.rs: Login, logout, and status messages now use styled output
  • main.rs: Session resume, server status, and mDNS messages use styled output
  • import_cmd.rs: Import success/warning messages use styled output
  • run_cmd.rs: Session sharing and clipboard messages use styled output
  • uninstall_cmd.rs: Backup and cleanup messages use styled output
  • github_cmd.rs: GitHub status messages use styled output

Before vs After

Before:

Successfully logged out
Warning: Failed to start mDNS advertising: ...

After:

✓ Logged out successfully. Credentials have been removed.
⚠ Failed to start mDNS advertising: ...

The messages are now more human-friendly with clear visual indicators and consistent styling across the CLI.

Add a new styled_output module that provides human-friendly, colorful CLI
messages that automatically adapt to terminal theme (light/dark) and respect
the NO_COLOR environment variable.

Changes:
- Created styled_output.rs with print_success, print_error, print_warning,
  print_info, and print_dim functions
- Messages use themed colors: success (green), error (red), warning (amber),
  info (blue)
- Icons: ✓ for success, ✗ for error, ⚠ for warning, ℹ for info
- Automatically detects light/dark theme via COLORFGBG and ITERM_PROFILE
- Updated login.rs, main.rs, import_cmd.rs, run_cmd.rs, uninstall_cmd.rs,
  and github_cmd.rs to use the new styled output

The messages are now more human-friendly with clear visual indicators and
consistent styling across the CLI.
@echobt echobt merged commit c2128a3 into master Jan 27, 2026
@echobt echobt deleted the feat/styled-cli-output branch January 27, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants