my zsh prompt is not bold
Asked Answered
I

4

9

I am customizing my zsh terminal but I face difficulties when it comes to turn my prompt into bold. I tried several different things, but none worked, whereas it did work for people on the Internet...

So this is my test prompt. Both "HEY" are in color 1, but the second "HEY" is supposed to be bold. It is obviously not, and instead of that, I get some flashy red, like the first part of my prompt, which is in color 9. wtf :)

Here is the code that I use in this case:

HEY%BHEY%b

I also noticed that it does the same thing for every one of the 8 first colors: black becomes grey, grey becomes white, night blue becomes dark blue, leaf green becomes flashy green, same for pink, yellow...

I also tried to use some escape sequences with the modulo, but none worked: each time, the modulo took the character next to it as its parameter and the rest of the code would just be displayed like normal characters. For example, this:

PS1="%{\e[1;33%}test"

would display this:

\e[1;33test

Could someone explain me what is going wrong here and how I could fix it to have some (real) bold prompt text?

Inn answered 8/4, 2017 at 13:42 Comment(0)
W
1

"ANSI" colors (escape codes) has a "bold" attribute, but it is often interpreted as "bright" instead. You may have to look in your terminal application's options to see if you can reconfigure it to interpret bold as bold instead of bright. I think you have to choose between supporting "bold" and "bright colors". See also https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

Whomever answered 13/4, 2017 at 17:17 Comment(0)
N
12

Read this doc and you will know what to do : Customizing the zsh Prompt

There are a bunch of options to modify zsh prompt.

For Bold, your command should be like this

PROMPT='%B %~ %b %# '

%B -> to start bold

%b -> to stop bold (so that only prompt is bold)

Norine answered 25/2, 2021 at 20:49 Comment(0)
E
7

this is late but might help someone, the way OP did it is correct, I believe the issue he's having is related to his font rendering settings.

here's a list of all the prompt variables used in zsh and tcsh

http://www.nparikh.org/unix/prompt.php

as it's stated there %B (%b) = Start (stop) boldface mode.

Entwine answered 2/11, 2019 at 12:8 Comment(0)
W
1

"ANSI" colors (escape codes) has a "bold" attribute, but it is often interpreted as "bright" instead. You may have to look in your terminal application's options to see if you can reconfigure it to interpret bold as bold instead of bright. I think you have to choose between supporting "bold" and "bright colors". See also https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

Whomever answered 13/4, 2017 at 17:17 Comment(0)
F
0

If you're using Windows Terminal, set Intense text style to Bold font or Bold font with bright colors under your profile's Appearance settings.

Friedlander answered 22/6 at 17:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.