kaisyu
7/17/2015 - 3:33 AM

Solarized for Mosh Chrome

Solarized for Mosh Chrome

// Solarized for Mosh Chrome
// Mosh does not seem to save profiles, so this sets the default 'mosh' profile.
// To reset, evaluate term_.prefs_.resetAll()

// Run in the JavaScript console of mosh_browser.html, which can be opened
// as explained here: 
// https://github.com/rpwoodbu/mosh-chrome/wiki/FAQ#how-can-i-change-the-way-the-terminal-looks-font-color-etc
 
var htermProfiles = {
    // Solarized Dark
    'solarized-dark': {
        'background-color': '#002b36',
        'foreground-color': '#839496',
        'cursor-color': 'rgba(131, 148, 150, 0.5)',
    },
    // Solarized Light
    'solarized-light': {
        'background-color': '#fdf6e3',
        'foreground-color': '#657b83',
        'cursor-color': 'rgba(101, 123, 131, 0.5)',
    }
};
 
var setSettings = function(profile) {
    
    console.log('Setting "mosh" profile to' + htermProfiles.name)
    term_.prefs_.resetAll();
 
    for (var name in htermProfiles[profile]) {
        console.log(name);
        console.log(htermProfiles[profile]);
        term_.prefs_.set(name, htermProfiles[profile][name]);
    }
 
    term_.prefs_.set('environment', { TERM: "xterm-256color" })
    term_.prefs_.set('color-palette-overrides', ['#073642', '#dc322f',
        '#859900', '#b58900', '#268bd2', '#d33682', '#2aa198', '#eee8d5',
        '#002b36', '#cb4b16', '#586e75', '#657b83', '#839496', '#6c71c4',
        '#93a1a1', '#fdf6e3']);
    term_.prefs_.set('font-size', 14);
    term_.prefs_.set('enable-bold', false);
    term_.prefs_.set('font-family', '"Fira Mono", "DejaVu Sans Mono", "Everson Mono", FreeMono, "Menlo", "Terminal", monospace');
    term_.prefs_.set('font-smoothing', 'subpixel-antialiased');
};
 

// To set to Solarized Light
// setSettings('solarized-light');
// Or Solarized dark:
setSettings('solarized-dark');
// Or reset
//term_.prefs_.resetAll();