Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect the terminal emulator's base colors #1098

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

nyonson
Copy link
Contributor

@nyonson nyonson commented Feb 5, 2025

This patch contains two changes to the CLI app which allows it to respect the base 16 colors of a terminal emulator. While a handful of dependencies print output, most are respecting the console settings already.

The first commit contains a tweak to the hard-coded goose prompt to instead use the console style. I am not sure how controversial this is, if there is special meaning to the teal color currently used. The following commit adds a variant that could be referenced to switch between them.

The second commit adds an Ansi variant to the theme. This is only used by the underlying bat renderer for now, but could be a spot for other renderers to hook into in the future if necessary.

Closes #1089

* Replace hardcoded ANSI color (teal/30) with console::style cyan.
* Prompt respects terminal's color scheme and NO_COLOR env var.

Make the prompt consistent with the rest of the CLI's
color scheme by using the terminal's native 16 colors instead
of a hardcoded extended color value.
* Theme variant can be used to select ansi/base16 versions of
underlying renderers, bat updated to use base16.
Copy link
Collaborator

@baxen baxen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Works on my setup as well

@baxen baxen merged commit 691a065 into block:main Feb 5, 2025
4 checks passed
michaelneale added a commit that referenced this pull request Feb 6, 2025
* main:
  Respect the terminal emulator's base colors (#1098)
  fix: add fallback sans-serif font to desktop app (#982)
  feat: add bedrock provider (#1069)
  feat: removed minHeight (#938)
  fix: add logs for goose run (#1085)
  docs: add langfuse observability guide (#1047)
  docs: updated bluesky link (#1078)
  docs: jetbrains tutorial (#1074)
  docs: add simple docs link (#1077)
  fix: apply cache control correctly to tools (#1071)
  fix: show default value when adding new one (#1057)
  fix it to use env vars if available (#1063)
  docs site: add PR previews (#865)
  chore: Better typing for preload.ts (#1055)
  fix: Allow port 443 to be used with https (ollama provider) (#1052)
Acumen-Desktop pushed a commit to Acumen-Desktop/goose that referenced this pull request Feb 7, 2025
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.

Add color control to goose cli
2 participants