Files
atom/src/app/theme.coffee
2013-04-18 18:50:22 -07:00

41 lines
877 B
CoffeeScript

fsUtils = require 'fs-utils'
###
# Internal #
###
module.exports =
class Theme
@stylesheets: null
@load: (name) ->
TextMateTheme = require 'text-mate-theme'
AtomTheme = require 'atom-theme'
if fsUtils.exists(name)
path = name
else
path = fsUtils.resolve(config.themeDirPaths..., name, ['', '.tmTheme', '.css', 'less'])
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)