Skip to content

Instantly share code, notes, and snippets.

@vnegrisolo
Last active September 27, 2016 03:34
Show Gist options
  • Save vnegrisolo/025c3af823fb99ef0a9ba572bce0b789 to your computer and use it in GitHub Desktop.
Save vnegrisolo/025c3af823fb99ef0a9ba572bce0b789 to your computer and use it in GitHub Desktop.
I created my own solarized theme colors for my blog with markdown code snippets. This is used to list all colors used by css class and lang, so I can adjust the colors used.
Array.prototype.uniq = function(){ return $.unique(this.sort()); };
log = (msg, bg, c)=> console.log('%c'+msg, 'background: '+bg+'; color: '+c);
classes = $('.highlighter-rouge pre code span').map((_,x)=> $(x).attr('class')).toArray().uniq();
languages = $('.highlighter-rouge .header').map((_,x)=> $(x).data('lang')).toArray().uniq();
classes.forEach(function(css){
log('=> '+css+' ','#eee8d5','#268bd2');
languages.forEach(function(lang){
log(' '+lang+' ', '#eee8d5','#2aa198');
nodes = $('.highlighter-rouge.language-'+lang+' pre code span.'+css);
texts = nodes.map((_,x)=> $(x).text()).toArray().uniq();
texts.forEach(function(text){ log(' '+text+' ', '#073642', nodes.css('color')); });
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment