██ ██
█████ ░░ ░██
██░░░██ ██ ██ ██ ██████████ ██████ ██████
░██ ░██░██ ░██░██░░██░░██░░██ █████░░░██░ ██░░░░██ █████
░░██████░░██ ░██ ░██ ░██ ░██ ░██░░░░░ ░██ ░██ ░██░░░░░
░░░░░██ ░░████ ░██ ░██ ░██ ░██ ░██ ░██ ░██
█████ ░░██ ░██ ███ ░██ ░██ ░░██ ░░██████
░░░░░ ░░ ░░ ░░░ ░░ ░░ ░░ ░░░░░░
██
░██
██ ██ █████ ██████ ░██ ██████ ██████ ██████
░░██ ██ ██░░░██ ██░░░░██ ░██ ██░░░░██░░██░░█ ██░░░░
░░███ ░██ ░░ ░██ ░██ ░██░██ ░██ ░██ ░ ░░█████
██░██ ░██ ██░██ ░██ ░██░██ ░██ ░██ ░░░░░██
██ ░░██░░█████ ░░██████ ███░░██████ ░███ ██████
░░ ░░ ░░░░░ ░░░░░░ ░░░ ░░░░░░ ░░░ ░░░░░░
Heavily based on a script from sleepanarchy.com
Extracts colors in hex format from (g)vim themes. The output is formatted in the X resources convention.
*.foreground: #f8f8f2
*.background: #282a36
*.cursorColor: #f8f8f2
*.color0: #f8f8f2
*.color1: #64666d
*.color2: #8be9fd
*.color3: #ff79c6
*.color4: #ff79c6
*.color5: #f8f8f2
*.color6: #50fa7b
*.color7: #f1fa8c
*.color8: #ff79c6
*.color9: #f1fa8c
*.color10: #ff79c6
*.color11: #ff79c6
*.color12: #bd93f9
*.color13: #bd93f9
*.color14: #bd93f9
There are also functions for printing the output as a flat list of colors (see printout
function)
The vimGroups variable defines the which highlight groups are extracted and their priority.
The normal group is treated separately and the Normal background and foreground color become the foreground and background property (not just colorN)
Run with python3 and point to a theme file.
python3 gvim-to-xcolors.py ~/.vim/colors/dracula.vim
Will not produce good results with more advances themes where there are variables and conditions. For such cases one can feed the script the output of :hi
(:redir is helpful here. More help)
I use it to generate i3wm colorschemes in conjunction with Charles Leifer's themer