src/view/ThemeManager.js
function loadFile(fileName, options) {
        var deferred         = new $.Deferred(),
            file             = FileSystem.getFileForPath(fileName),
            currentThemeName = prefs.get("theme");

        file.exists(function (err, exists) {
            var theme;

            if (exists) {
                theme = new Theme(file, options);
                loadedThemes[theme.name] = theme;
                ThemeSettings._setThemes(loadedThemes);

                // For themes that are loaded after ThemeManager has been loaded,
                // we should check if it's the current theme.  If it is, then we just
                // load it.
                if (currentThemeName === theme.name) {
                    refresh(true);
                }

                deferred.resolve(theme);
            } else if (err || !exists) {
                deferred.reject(err);
            }
        });

        return deferred.promise();
    }
function loadFile(fileName, options) {
        var deferred         = new $.Deferred(),
            file             = FileSystem.getFileForPath(fileName),
            currentThemeName = prefs.get("theme");

        file.exists(function (err, exists) {
            var theme;

            if (exists) {
                theme = new Theme(file, options);
                loadedThemes[theme.name] = theme;
                ThemeSettings._setThemes(loadedThemes);

                // For themes that are loaded after ThemeManager has been loaded,
                // we should check if it's the current theme.  If it is, then we just
                // load it.
                if (currentThemeName === theme.name) {
                    refresh(true);
                }

                deferred.resolve(theme);
            } else if (err || !exists) {
                deferred.reject(err);
            }
        });

        return deferred.promise();
    }
function loadFile ( fileName , options ) { var deferred = new $ . Deferred ( ) , file = FileSystem . getFileForPath ( fileName ) , currentThemeName = prefs . get ( "theme" ) ; file . exists ( function ( err , exists ) { var theme ; if ( exists ) { theme = new Theme ( file , options ) ; loadedThemes [ theme . name ] = theme ; ThemeSettings . _setThemes ( loadedThemes ) ; // For themes that are loaded after ThemeManager has been loaded, // we should check if it's the current theme.  If it is, then we just // load it. if ( currentThemeName === theme . name ) { refresh ( true ) ; } deferred . resolve ( theme ) ; } else if ( err || ! exists ) { deferred . reject ( err ) ; } } ) ; return deferred . promise ( ) ; }
Loads a theme from a file.

@param {string} fileName is the full path to the file to be opened
@param {Object} options is an optional parameter to specify metadata
for the theme.
@return {$.Promise} promise object resolved with the theme to be loaded from fileName
Loads a theme from a file .