Skip to content

Instantly share code, notes, and snippets.

@yuya-takeyama
Created September 30, 2011 15:15
Show Gist options
  • Save yuya-takeyama/1254056 to your computer and use it in GitHub Desktop.
Save yuya-takeyama/1254056 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(200, 200, 200);');
changeStyle('o', 'color: rgb(200, 200, 200);');
changeStyle('p', 'color: rgb(255, 255, 255);');
changeStyle('k', 'color: rgb(222, 49, 103);');
changeStyle('n', 'color: rgb(155, 41, 36);');
changeStyle('err', 'color: rgb(233, 180, 200); background: none;');
changeStyle('nc', 'color: rgb(168, 247, 141);');
changeStyle('nf', 'color: rgb(233, 180, 200);');
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( 66, 255, 135);');
changeStyle('kd', 'color: rgb(163, 216, 121);');
changeStyle('kp', 'color: rgb(252, 241, 141);');
changeStyle('sd', 'color: rgb(202, 248, 180);');
changeStyle('s1', 'color: rgb(250, 208, 100);');
changeStyle('highlight', 'background: rgb(0, 0, 0);');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment