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

Prompt: Color of the git branch #187

Closed
Tracked by #185
certik opened this issue Jan 16, 2025 · 2 comments
Closed
Tracked by #185

Prompt: Color of the git branch #187

certik opened this issue Jan 16, 2025 · 2 comments

Comments

@certik
Copy link
Collaborator

certik commented Jan 16, 2025

I used to use red color for years. But the default on macOS seems to be green:

Image

The first is shell, the second is zsh. I actually kind of like the green color. So I wonder if we should use it by default.

We need to enable configuring the prompt, so that users can set it up any way they like.

@certik certik mentioned this issue Jan 16, 2025
11 tasks
@certik
Copy link
Collaborator Author

certik commented Jan 16, 2025

Here is how to achieve the green color:

--- a/crates/shell/src/main.rs
+++ b/crates/shell/src/main.rs
@@ -115,7 +115,7 @@ async fn interactive(state: Option<ShellState>, norc: bool) -> miette::Result<()
             };

             let prompt = format!("{}{git_branch}$ ", display_cwd);
-            let color_prompt = format!("\x1b[34m{}\x1b[31m{git_branch}\x1b[0m$ ", display_cwd);
+            let color_prompt = format!("\x1b[34m{}\x1b[32m{git_branch}\x1b[0m$ ", display_cwd);
             rl.helper_mut().unwrap().colored_prompt = color_prompt;
             rl.readline(&prompt)
         };

certik added a commit to certik/shell that referenced this issue Jan 20, 2025
This agrees with the default prompt in `zsh` on macOS, and it seems less
distracting than the red color, which seems to suggest some error state.

Towards prefix-dev#187.
prsabahrami pushed a commit that referenced this issue Jan 20, 2025
This agrees with the default prompt in `zsh` on macOS, and it seems less
distracting than the red color, which seems to suggest some error state.

Towards #187.
@certik
Copy link
Collaborator Author

certik commented Jan 20, 2025

I opened up #200 for the general solution to this.

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

No branches or pull requests

2 participants