Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created November 21, 2011 03:28
Show Gist options
  • Save ryanflorence/1381526 to your computer and use it in GitHub Desktop.
Save ryanflorence/1381526 to your computer and use it in GitHub Desktop.
Random color scheme for vim
function RandomColorScheme()
let mycolors = split(globpath(&rtp,"**/colors/*.vim"),"\n")
exe 'so ' . mycolors[localtime() % len(mycolors)]
unlet mycolors
endfunction
call RandomColorScheme()
:command NewColor call RandomColorScheme()
@kostaz
Copy link

kostaz commented Apr 24, 2022

To use random color from a list of your favorite colors do this (tested in neovide):

function RandomColorSchemeMyPicks()
    let mypicks = ["pyte", "fokus", "github", "peachpuff", "morning", "simple256", "xcode", "gruvbox"]
    let mypick = mypicks[localtime() % len(mypicks)]
    echom mypick
    execute 'colo' mypick
endfunction

command NewColor call RandomColorSchemeMyPicks()

let s:use_gui = exists('g:neovide') || has('gui_running') || (has('termguicolors') && &termguicolors)
if (s:use_gui)
    call RandomColorSchemeMyPicks()
endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment