All Projects → nightsense → Cosmic_latte

nightsense / Cosmic_latte

☕ vim + emacs + textmate/sublime + atom + terminal (theme | colorscheme | color scheme) based on the color of the universe

cosmic_latte

from highest heaven…
become one with the UIverse
…to deepest ocean
screenshot of the cosmic_latte vim theme, light version screenshot of the cosmic_latte vim theme, dark version
Normal bg Identifier Normal bg
ColorColumn Special ColorColumn
MatchParen Statement MatchParen
Comment PreProc Comment
Normal fg Constant Normal fg
Cursor Type Cursor
Search Spell Search

All colors are derived from the average color of the universe
through application of the golden ratio, simple contrast ratios,
and simple multiples, using the LCh color model.

See the snow repository for syntax highlighting color logic.

installation

If you don’t have a preferred plugin management method, consider vim-plug, which can be installed (on *nix systems) with:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

With vim-plug, cosmic_latte can be installed by adding the following to the top of your vimrc:

call plug#begin('~/.vim/plugged')
Plug 'nightsense/cosmic_latte'
call plug#end()

…then restarting vim, followed by running :PlugUpdate (at the vim command line).

activation

To activate the light version of cosmic_latte:

set background=light
colorscheme cosmic_latte

Or the dark version:

set background=dark
colorscheme cosmic_latte

To set the version automatically based on vim launch time:

if strftime('%H') >= 7 && strftime('%H') < 19
  set background=light
else
  set background=dark
endif
colorscheme cosmic_latte

…which activates the light version during the day (defined here as 7AM-7PM), dark version at night.

Be sure to set colorscheme after background, otherwise some theme colors may not be applied.

status line themes

Themes for airline and lightline can be activated with the following vimrc code:

airline lightline
let g:airline_theme='cosmic_latte_light' let g:lightline = { 'colorscheme': 'cosmic_latte_light' }
let g:airline_theme='cosmic_latte_dark' let g:lightline = { 'colorscheme': 'cosmic_latte_dark' }

Status line themes can be added to the time-based snippet above:

if strftime('%H') >= 7 && strftime('%H') < 19
  set background=light
  let g:lightline = { 'colorscheme': 'cosmic_latte_light' }
else
  set background=dark
  let g:lightline = { 'colorscheme': 'cosmic_latte_dark' }
endif
colorscheme cosmic_latte

terminal vim

colors

Terminals/multiplexers with true-color support can precisely display the theme colors.

In most cases, the only required vimrc setting is:

set termguicolors

In some cases (see :h xterm-true-color for explanation) it may be necessary to add:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

If termguicolors is not set, terminal vim will fall back to a rough approximation of the theme, drawing from the terminal emulator's 256-color palette (if present).

The fallback version of cosmic_latte defines colors using numbers in the range 0-255 (as opposed to 6-character hex codes, whose range of 224 values provides "true color"). Terminal emulators with 256-color support understand this encoding, though they vary in the exact color associated with each number. The closest thing to a standard 256-color *nix palette is that used by xterm, the default X Windows terminal emulator.

cursor shape

To set mode-specific cursor shapes in terminal vim, see the Vim Tips Wiki.

For instance, to set cursor shapes in vte-compatible terminals:

let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"

…which sets the cursor to a vertical line for insert mode, underline for replace mode, and block for normal mode.

shell

colors

Many terminal emulators (including iTerm2, GNOME Terminal, Pantheon Terminal, MATE Terminal, Xfce Terminal, LXTerminal, Terminator, Guake, Alacritty, and kitty) can be themed by sourcing the color-setting shell scripts included with cosmic_latte. You can download these scripts directly to a folder of your choosing, and source them from there; or, if cosmic_latte is already installed as a vim plugin, you can source them from the vim plugin path (which varies by plugin management method).

For instance, if you use vim-plug and want to apply the dark cosmic_latte theme to your bash or zsh shell, add the following to ~/.bashrc or ~/.zshrc:

[ -n "$PS1" ] && sh ~/.vim/plugged/cosmic_latte/shell/cosmic_latte_dark.sh

Or for the fish shell, add to ~/.config/fish/config.fish:

if status --is-interactive
  sh ~/.vim/plugged/cosmic_latte/shell/cosmic_latte_dark.sh
end

If you use vundle, replace plugged in the above paths with bundle.

Replace dark with light for the light theme.

dircolors

Color output (for distinguishing file types) of the ls command can be themed by sourcing the included "dircolors" file. The path to this file will depend on your vim plugin management method.

For instance, if you use vim-plug and want to apply the cosmic_latte dircolors to your bash or zsh shell, add the following to ~/.bashrc or ~/.zshrc:

eval `dircolors ~/.vim/plugged/cosmic_latte/shell/dircolors`

Or for the fish shell, add to ~/.config/fish/config.fish:

eval (dircolors -c ~/.vim/plugged/cosmic_latte/shell/dircolors)

If you use vundle, replace plugged in the above paths with bundle.

fish syntax

Again, the script path will depend on your plugin management method.

For the dark theme in a vim-plug setup, add to ~/.config/fish/config.fish:

source ~/.vim/plugged/cosmic_latte/shell/cosmic_latte_dark.fish

other themes

emacs

  • put these files somewhere in your load-path: dash.el + cosmic_latte_light.el | cosmic_latte_dark.el
    • for instance, you could put them in ~/.emacs.d/load
    • and put (add-to-list 'load-path "~/.emacs.d/load") in your init.el
  • put these files in ~/.emacs.d/themes: cosmic_latte_light-theme.el | cosmic_latte_dark-theme.el
  • put (add-to-list 'custom-theme-load-path "~/.emacs.d/themes") in your init.el
  • load cosmic_latte manually with M-x load-theme
    • or automatically with (load-theme 'cosmic_latte_light' t) in your init.el, for the light version
    • or (load-theme 'cosmic_latte_dark' t) for the dark version

This emacs theme is, for now, simply a find/replace conversion of bbatsov/solarized-emacs.

TextMate | Sublime Text

  • download theme file (light | dark)
  • for TextMate: double-click the file to install and activate it
    • the theme will become available in Preferences > Fonts & Colors
  • for Sublime Text:
    • find your Packages folder by opening Sublime Text and navigating: Preferences > Browse Packages…
      • e.g. ~/.config/sublime-text-3/Packages/User/
    • place theme file in Packages folder
    • activate from the list at: Preferences > Color Scheme…

This theme is, for now, simply a find/replace conversion of deplorableword/textmate-solarized.

Atom

  • add contents of theme file (light | dark) to your styles.less
    • you can open this file from Atom by navigating: Edit > Preferences > Themes > "your stylesheet"
    • alternatively, save the theme file somewhere else and add an @import to styles.less
      • e.g. @import "/home/username/.atom/cosmic_latte_light.less";

These themes are based on One Light/Dark Syntax.

terminals

  • iterm2
    • download theme file (light | dark)
    • launch iTerm and navigate: iTerm > Preferences > Profiles > Colors > Presets… > Import…
    • select downloaded file, then select cosmic_latte theme from Preset… menu
  • kitty
    • add contents of theme file (light | dark) to ~/.config/kitty/kitty.conf, or download theme file and source from kitty.conf (e.g. include ~/path/to/theme/cosmic_latte-light.conf)
  • konsole
    • download theme file (light | dark) to ~/.local/share/konsole, retaining file extension .colorscheme
    • launch Konsole and navigate: Settings > Edit Current Profile… > Appearance
    • select cosmic_latte theme from Color Schemes & Background pane
  • st
  • xresources

misc

building from source

From the templates directory, run: fish generate.fish.

Dependencies:

  • fish shell
  • colormath Python module

               

The 4.5:1 W3C contrast ratio standard for readability is met by all text-background combinations, with the exception of some transient highlighting (e.g. cursorline/column), which nonetheless well exceeds the minimal ISO 3:1 standard.
image credits:
other credits:
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].