Available colors in iTerm / terminal.app

coloritermvi

I'm trying to make my own colorscheme in Vim, but are struggling to see the available colors in iTerm. Here are my iTerm-color-settings:

enter image description here

Here's how I can use it in Vim (for example using ctermfg=darkred):

iTerm color       Vim-color
----------------------------
Normal-red        darkred
Bright-red        red 

Normal-blue       blue
Bright-blue       lightblue

So it appears to me, that Vim has both

'darkred'   'red'   and   'lightred'

… But as you can see, then sometimes the 'Normal'-color is the Vim-dark-color, and sometimes the it's just the regular color. Is there a reason for that? And are there a system for it, or how does Vim know which color in iTerm to use?


I don't know, if it's of any help, but if I edit an .itermcolors-file, then the colors look like this:

<key>Ansi 1 Color</key>
<dict>
    <key>Blue Component</key>
    <real>0.30443088503649635</real>
    <key>Green Component</key>
    <real>0.18199703467153286</real>
    <key>Red Component</key>
    <real>0.83819000912408759</real>
</dict>

Best Answer

By writing :help cterm-colors in Vim, then I got the left side of the following table. By trial-and-error, I tried out different colors from iTerm and figured out the following (ready to be copied into a .vim-colorscheme to help remember what is what:

" AVAILABLE ANSI COLORS IN iTerm
" 
" 0 =     Black                     - iTerm-ref: Black, normal
" 1 =     DarkBlue                  - iTerm-ref: Blue, normal
" 2 =     DarkGreen                 - iTerm-ref: Green, normal
" 3 =     DarkCyan                  - iTerm-ref: Cyan, normal 
" 4 =     DarkRed                   - iTerm-ref: Red, normal
" 5 =     DarkMagenta               - iTerm-ref: Magenta, normal
" 6 =     Brown, DarkYellow         - iTerm-ref: ??
" 7 =     Grey                      - iTerm-ref: ??
" 8 =     DarkGrey                  - iTerm-ref: ??
" 9 =     Blue, LightBlue           - iTerm-ref: Blue, bright
" 10 =    Green, LightGreen         - iTerm-ref: Green, bright
" 11 =    Cyan, LightCyan           - iTerm-ref: Cyan, bright
" 12 =    Red, LightRed             - iTerm-ref: Red, bright
" 13 =    Magenta, LightMagenta     - iTerm-ref: Magenta, bright
" 14 =    Yellow, LightYellow       - iTerm-ref: Yellow, bright
" 15 =    White                     - iTerm-ref: White, bright 

The colors with question-marks are unable to be changed (unless I'm blind or something).