Skip to content

Instantly share code, notes, and snippets.

@malikbenkirane
Created June 20, 2018 22:28
Show Gist options
  • Save malikbenkirane/df7a5b87d1b2ad5a3045ec0a771a2099 to your computer and use it in GitHub Desktop.
Save malikbenkirane/df7a5b87d1b2ad5a3045ec0a771a2099 to your computer and use it in GitHub Desktop.
/* flattened dark
*
black color0 #073642 color8 #002b36
red color1 #dc322f color9 #cb4b16
green color2 #859900 color10 #586e75
yellow color3 #b58900 color11 #657b83
blue color4 #268bd2 color12 #839496
magenta color5 #d33682 color13 #6c71c4
cyan color6 #2aa198 color14 #93a1a1
white color7 #eee8d5 color15 #fdf6e3
foreground #839496
background #002b36
*
* flattened light
*
black color0 #eee8d5 color8 #fdf6e3
red color1 #dc322f color9 #cb4b16
green color2 #859900 color10 #93a1a1
yellow color3 #b58900 color11 #839496
blue color4 #268bd2 color12 #657b83
magenta color5 #d33682 color13 #6c71c4
cyan color6 #2aa198 color14 #586e75
white color7 #073642 color15 #002b36
foreground #657b83
background #fdf6e3
*
* 'Dark Backround Light Text' preferences inputs
*
* pref_default_foreground_color
* pref_default_background_color
* pref_default_link_color
* pref_default_visited_color
* pref_default_active_color
* pref_default_selection_color
*
*/
/* custom colors from dark flattened colors */
var flattened_colors = {
};
flattened_colors.background = '#002b36';
flattened_colors.foreground = '#839496';
flattened_colors.blue = '#268bd2';
flattened_colors.magenta = '#d33682';
flattened_colors.red = '#dc322f';
flattened_colors.yellow = '#b58900';
var flattened = {
};
flattened.dark = {
'background': flattened_colors.background,
'foreground': flattened_colors.foreground,
'link': flattened_colors.blue,
'visited': flattened_colors.yellow,
'active': flattened_colors.red,
'selection': flattened_colors.magenta
};
/* custom colors from light flattened colors */
flattened_colors = {
};
flattened_colors.background = '#fdf6e3';
flattened_colors.foreground = '#657b83';
flattened_colors.blue = '#268bd2';
flattened_colors.magenta = '#d33682';
flattened_colors.red = '#dc322f';
flattened_colors.yellow = '#b58900';
flattened.light = {
'background': flattened_colors.background,
'foreground': flattened_colors.foreground,
'link': flattened_colors.blue,
'visited': flattened_colors.magenta,
'active': flattened_colors.red,
'selection': flattened_colors.yellow
};
/* select the colorscheme variant */
var scheme = 'dark';
/* apply colors */
[
'background',
'foreground',
'link',
'visited',
'active',
'selection'
].forEach(function (component) {
el = $('input[type="text"].pref_default_' + component + '_color');
el.value = flattened[scheme][component];
if ('createEvent' in document) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent('change', false, true);
el.dispatchEvent(evt);
}
else
el.fireEvent('onchange');
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment