refactor(prompt)!: use nu_ansi_term::Color throughout Prompt Trait#1128
Merged
kronberger-droid merged 3 commits intoJul 22, 2026
Merged
Conversation
Collaborator
Author
|
Since nushell/nushell#18686 is not merged now we can just update the reedline reference and don't have to change anything else, since nushell used the default impls from reedline before. |
Contributor
|
ok, we can land this when you're ready. |
BREAKING CHANGE: Prompt::get_prompt_color, get_indicator_color and get_prompt_right_color now take nu_ansi_term::Color, and reedline::Color re-exports it instead of crossterm's. Note crossterm's Green/Cyan are the bright palette entries; the nu-ansi-term equivalents are LightGreen/LightCyan.
crossterm's Green/Cyan are palette 10/14 (it spells the dark ones DarkGreen/DarkCyan); nu-ansi-term's are 2/6. The name-for-name translation darkened the prompt and indicator. Use LightGreen/LightCyan, which also match nushell's light_green / light_cyan config names.
Covers the SGR bytes emitted for prompt, indicator and right prompt on both buffer paths: the trait defaults, Color::Default emitting an explicit SGR 39 (nushell#1046), the use_ansi_coloring guards, and that crossterm's Green/Cyan were the bright palette entries.
kronberger-droid
force-pushed
the
change-crossterm-color-to-nu-ansi
branch
from
July 22, 2026 13:37
e1942c0 to
cf4652e
Compare
fdncred
pushed a commit
to nushell/nushell
that referenced
this pull request
Jul 22, 2026
<!-- Thanks for contributing to Nushell! Before submitting, please read the contributing guide: https://github.com/nushell/nushell/blob/main/CONTRIBUTING.md This template helps reviewers understand your changes and allows us to generate high-quality release notes. --> ## Description <!-- Explain what this PR does and why. This section is intentionally flexible: - Describe the problem - Explain your approach - Include technical details if relevant Good examples: - "In this PR, I fixed..." - "In this PR, I added support for..." - "This change improves X by..." Write as much or as little as needed for reviewers to understand your changes. --> Includes nushell/reedline#1128, which switches the `Prompt` trait to `nu_ansi_term::Color` exclusively, and nushell/reedline#1112, which adds typed inherent methods and a JSON filter to `SqliteBackedHistory`. Despite nushell/reedline#1128 being a breaking change, nushell needs no source changes. `NushellPrompt` only ever used the defaulted `get_*_color` methods, so the new return type has no effect here. ## User-facing changes (Release notes) <!-- This section is used (mostly as-is) for https://www.nushell.sh/blog/ Describe how Nushell behavior changes from a user's perspective. Do NOT describe internal Rust changes here. Write in a release note style, for example: - "Added support for..." - "Fixed an issue where..." - "Nushell now supports..." - "Improved performance of..." If your changes do NOT affect users (internal refactors, cleanup, etc.), just write: - "n/a" - "nan" - or similar This tells us the change should not appear in the changelog. Tips: - Focus on observable behavior - Include examples if helpful - Keep it concise You can: - Write a short paragraph (will appear as a bullet point), OR - Use headings (###) if your change needs more structure Avoid writing things like: - "In this PR, I refactored..." - "This updates internal code..." You may leave this blank until the PR is ready. --> ## Additional notes <!-- Optional. Examples: - fixes #123 - closes #456 - related #789 Anything else reviewers should know. Remove this section if not needed. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three functions of the
PromptTrait returnedcrossterm::Colorinstead of the establishednu_ansi_term::Color.This PR changes this to match the convention of the repo.
In turn I had to change the
const DEFAULT_PROMPT_*_COLORvalues to match the default palette.These will now also be exported such that nushell does not have to define it itself in nushell/nushell#18686.
Also I switched the
crossterm::Colorreexport tonu_ansi_term::Color.This change should be Behavior Preserving, but introduces a...
Breaking Change!:
The four Prompt Trait functions
get_*_color(&self)now all returnnu_ansi_term::Colorinstead ofcrossterm::Color.This will force every downstream consumer to change its Trait Implementation!
Additional notes
added tests to pin prompt color output across the switch
related #1046, nushell/nushell#18686