Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Short answer: no, <code>zsh</code> can't help you here. You need to change the <em>terminal emulator</em> color settings, not the <code>zsh</code> settings. </p> <p>This is what you're currently seeing:</p> <p><img src="https://i.stack.imgur.com/fCZo2.png" alt="What you&#39;re seeing"></p> <p>and this is what you're expecting to see:</p> <p><img src="https://i.stack.imgur.com/AZ3OR.jpg" alt="The RobbyRussell Theme"></p> <p>This is the line that produces this prompt: </p> <pre><code>PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' </code></pre> <p>The Z-Shell <em>does</em> have some <code>foreground</code>, <code>background</code> settings you can use in the <code>PROMPT</code> - that's what the <code>fg_bold</code> means (<em>foreground</em> to <em>bold</em>). You can replace this with <code>bg_</code> for background, and omit the <code>bold</code> to use a non-bold font. </p> <p>For example, we can set the background of the <code>PROMPT</code> to <code>green</code> by adding <code>%{bg[green]%}</code>:</p> <pre><code>PROMPT='%{$bg[green]%}%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' </code></pre> <p>This results in: </p> <p><img src="https://i.stack.imgur.com/B3IHv.png" alt="Green background in the prompt"></p> <p>However, this more than likely is <strong>not what you want</strong>. Note several things:</p> <ol> <li>The <code>bg[green]</code> does <em>not</em> extend to the edge of the terminal window - the <code>PROMPT</code> settings <strong>only work where the line is drawn</strong>. </li> <li>The background color is reset to 'default' at the end of the prompt - that's done by <code>%{$reset_color%}</code> (necessary to change the <code>foreground</code> color to default). Getting a consistant, whole-line background color gets messy quickly. </li> </ol> <h3>How the colors work</h3> <p>Roughly (I could be wrong in details, but the overall gist is correct, I believe): the shell you use sends a <code>color code</code> to the <em>terminal emulator</em>. The <em>terminal emulator</em> is responsible for interpreting that color code, and displaying it on the screen. This means there are two settings you can fiddle with:</p> <ol> <li>The <code>shell</code> color settings. That's what you're doing in your <code>zshrc</code>. Primiarily, this allows for consistency - you can say "Display <em>this</em> bit of the prompt in the same <code>$COLOR</code> as <em>that</em> bit of the prompt". This <strong>doesn't</strong> mean the user will <em>see</em> the prompt in <code>$COLOR</code>; <code>$COLOR</code> is a label, not much more. </li> <li>The <em>displayed color settings</em>. That's where you set the preferred <code>font</code>, <code>background</code>, <code>text color</code>, etc. It's where you can say "display everything the shell says is <code>$COLOR_1</code> as <code>red</code>, <code>$COLOR_2</code> as <code>green</code>", etc. </li> </ol> <p>There are 16 colors you can use in an <code>ANSI</code> terminal, which may-or-may-not be displayed correctly. Check <a href="http://en.wikipedia.org/wiki/ANSI_escape_code#Colors" rel="noreferrer">this table</a> for some common terminal colors, and note the differences displayed between them! </p> <h3>Fixing your colors</h3> <p>If you're using <code>Terminal.app</code> (on OS X, I'd recommend <code>iTerm2</code>), open the preferences for Terminal (<kbd>command</kbd>+<kbd>,</kbd>), and select "Settings". There's a bunch of "profiles" you can choose from - to emulate the <code>robbyrussell</code> screenshot above, you'd want to fiddle with the colors a little. "Homebrew" is pretty close, but has different "text" colors (green instead of white). </p> <p>[Here is the <code>robbyrussell</code> <code>zsh</code> theme with the <code>Homebrew</code> Terminal.app profile:</p> <p><img src="https://i.stack.imgur.com/mZw3K.png" alt="Robby Russel &lt;code&gt;zsh&lt;/code&gt; theme with &lt;code&gt;Homebrew&lt;/code&gt; Terminal.app profile"></p> <p>If you'd like a good, pre-set, easy-on-the-eyes color scheme, check out <a href="http://ethanschoonover.com/solarized" rel="noreferrer">Solarized</a>. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload