Files
atom/src/app/theme.coffee
Kevin Sawicki & Nathan Sobo 501dc9b76c Merge remote-tracking branch 'origin/master' into cefode
Conflicts:
	native/v8_extensions/native.mm
	spec/app/config-spec.coffee
	spec/app/window-spec.coffee
	spec/spec-helper.coffee
	spec/stdlib/fs-utils-spec.coffee
	src/app/atom-package.coffee
	src/app/config.coffee
	src/app/window.coffee
	src/packages/fuzzy-finder/lib/load-paths-handler.coffee
	src/packages/markdown-preview/lib/markdown-preview-view.coffee
	src/packages/tree-view/spec/tree-view-spec.coffee
	src/stdlib/require.coffee
2013-03-20 10:46:50 -06:00

37 lines
840 B
CoffeeScript

fs = require 'fs-utils'
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', '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)