mirror of
https://github.com/atom/atom.git
synced 2026-02-06 20:55:33 -05:00
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
37 lines
840 B
CoffeeScript
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)
|