Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mEGGrim/1292356 to your computer and use it in GitHub Desktop.
Save mEGGrim/1292356 to your computer and use it in GitHub Desktop.
Changes style of Gist's syntax highlight to paste into some presentation tools like Keynote.
// ==UserScript==
// @name paste_your_code_your_color.user.js
// @namespace http://yuyat.jp/
// @description Changes style of Gist's syntax highlight
// @include https://gist.github.com/*
// ==/UserScript==
(function () {
var changeStyle = function (className, style) {
var
elements = document.getElementsByClassName(className),
i;
for (i = 0; i < elements.length; i++) {
elements[i].setAttribute('style', style);
}
};
changeStyle('a', 'color: rgb(100, 100, 100);');
changeStyle('o', 'color: rgb(100, 100, 100);');
changeStyle('p', 'color: rgb(0, 0, 0);');
changeStyle('k', 'color: rgb(222, 49, 103);');
changeStyle('n', 'color: rgb(155, 41, 36);');
changeStyle('err', 'color: rgb(213, 160, 180); background: none;');
changeStyle('nc', 'color: rgb(168, 247, 141);');
changeStyle('nf', 'color: rgb(233, 150, 170);');
changeStyle('nv', 'color: rgb(109, 184, 255);');
changeStyle('nx', 'color: rgb(229, 133, 38);');
changeStyle('na', 'color: rgb( 66, 255, 135);');
changeStyle('nb', 'color: rgb( 36, 230, 105);');
changeStyle('kd', 'color: rgb(103, 216, 60);');
changeStyle('kp', 'color: rgb(202, 201, 101);');
changeStyle('sd', 'color: rgb(150, 248, 130);');
changeStyle('s1', 'color: rgb(200, 158, 50);');
changeStyle('highlight', 'background: rgb(255, 255, 255);');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment