Skip to content

Instantly share code, notes, and snippets.

@t9md
Last active August 29, 2015 14:24
Show Gist options
  • Save t9md/e1a8597ccd7225080e3b to your computer and use it in GitHub Desktop.
Save t9md/e1a8597ccd7225080e3b to your computer and use it in GitHub Desktop.
Automatically swich theme in Atom whether it is in dev mode or based on project dir name.
# use this in your init.coffee
themeSets =
"vim-mode": ["atom-light-ui", "atom-light-syntax"]
"atom": ["atom-dark-ui", "monokai"]
"_devMode": ["one-dark-ui", "one-dark-syntax"]
"_default": ["atom-dark-ui", "base16-tomorrow-dark-theme"]
path = require 'path'
autoSwitchTheme = ->
theme = null
if atom.inDevMode()
theme = themeSet['_devMode']
else
for _path in atom.project.getPaths()
break if theme = themeSets[path.basename(_path)]
theme = "_default" unless theme
atom.config.set('core.themes', theme)
autoSwitchTheme()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment