liuchengxu / space-vim-theme

:blossom: A dark and light colorscheme for space-vim that supports GUI & terminal
159 stars 26 forks source link

[Feature Request] Alacritty terminal color shemes #5

Open ngortheone opened 4 years ago

ngortheone commented 4 years ago

Hi @liuchengxu

Thanks for awesome work. I enjoy using this theme with vim.

Could you please create light and dark color themes for Alacritty terminal?

https://github.com/alacritty/alacritty/wiki/Color-schemes

Thanks

alexanderjeurissen commented 4 years ago

@ngortheone If you are using neovim there is an easy way to do this as most neovim supported colorschemes have terminal colors defined (for neovim terminal)

these can be read using the following global var: g:terminal_ansi_colors when using this theme this returns:

['#fbf8ef', '#d26487', '#35a8a5', '#b89f33', '#6981c5', '#a15ea7', '#288668', '#504259', '#a8a4ae', '#f2241f', '#67b11d', '#b1951d', '#3a81c3', '#6c3163', '#24775c', '#655370']

These colors map to the 16 colors that are defined in your alacritty.yml

colors:
  # Default colors
  primary:
    background: ''
    foreground: ''

  # Colors the cursor will use if `custom_cursor_colors` is true
  cursor:
    text: ''
    cursor: ''

  # Normal colors
  normal:
    black:   'ansi_color_0'
    red:     'ansi_color_1'
    green:   'ansi_color_2'
    yellow:  'ansi_color_3'
    blue:    'ansi_color_4'
    magenta: 'ansi_color_5'
    cyan:    'ansi_color_6'
    white:   'ansi_color_7'

  # Bright colors
  bright:
    black:   'ansi_color_8'
    red:     'ansi_color_9'
    green:   'ansi_color_10'
    yellow:  'ansi_color_11'
    blue:    'ansi_color_12'
    magenta: 'ansi_color_13'
    cyan:    'ansi_color_14'
    white:   'ansi_color_15'

Simply replace the ansi_color_x with the corresponding index in the array above.

Now when it comes to the background, foreground, and curusor colors those you can obtain by looking at the relevant corresponding vim highlight groups:

background => :hi Normal (look at the guibg value and copy paste it) foreground => :hi Normal (look at the guifg value and copy paste it)

cursor => :hi Cursor

Hope this helps.

ngortheone commented 4 years ago

@alexanderjeurissen thanks!

As I understand this method can be applied to any vim theme to get alacritty theme out of it, right?

alexanderjeurissen commented 4 years ago

Yes that is right, as long as the author of the colorscheme has defined colors for neovim's terminal mode.

I'm not sure if this also applies to Vim8