Modules (188)

ThemeView

Description

Dependencies

Functions

Public API

updateScrollbars

Load scrollbar styling based on whether or not theme scrollbars are enabled.

theme ThemeManager.Theme
Is the theme object with the corresponding scrollbar style to be updated
    function updateScrollbars(theme) {
        theme = theme || {};
        if (prefs.get("themeScrollbars")) {
            var scrollbar = (theme.scrollbar || []).join(" ");
            $scrollbars.text(scrollbar || "");
        } else {
            $scrollbars.text("");
        }
    }
Public API

updateThemes

Handles updating codemirror with the current selection of themes.

cm CodeMirror
is the CodeMirror instance currently loaded
    function updateThemes(cm) {
        var newTheme = prefs.get("theme"),
            cmTheme  = (cm.getOption("theme") || "").replace(/[\s]*/, ""); // Normalize themes string

        // Check if the editor already has the theme applied...
        if (cmTheme === newTheme) {
            return;
        }

        // Setup current and further documents to get the new theme...
        CodeMirror.defaults.theme = newTheme;
        cm.setOption("theme", newTheme);
    }


    exports.updateScrollbars = updateScrollbars;
    exports.updateThemes     = updateThemes;
});