Files
atom/src/app/theme.coffee
2013-01-31 19:01:44 -05:00

37 lines
826 B
CoffeeScript

fs = require 'fs'
module.exports =
class Theme
@stylesheets: null
@load: (name) ->
TextMateTheme = require 'text-mate-theme'
AtomTheme = require 'atom-theme'
if fs.exists(name)
path = name
else
path = fs.resolve(config.themeDirPaths..., name, ['', '.tmTheme', '.css'])
throw new Error("No theme exists named '#{name}'") unless path
theme =
if TextMateTheme.testPath(path)
new TextMateTheme(path)
else
new AtomTheme(path)
theme.load()
theme
constructor: (@path) ->
@stylesheets = {}
load: ->
for stylesheetPath, stylesheetContent of @stylesheets
applyStylesheet(stylesheetPath, stylesheetContent, 'userTheme')
deactivate: ->
for stylesheetPath, stylesheetContent of @stylesheets
removeStylesheet(stylesheetPath)