Rainbow Parentheses Highlighting on GitHub (Clojure etc.)
Rainbow Parentheses Highlighting on GitHub (Clojure etc.)
Run it in console (i.e., devtools or other) on a github source view page. (E.g., https://github.com/LightTable/LightTable/blob/master/src/lt/object.cljs) If someone wants to make this into a Chrome Extension, that would be cool. I realize the code is terrible; I just threw it together in dev tools. var rainbow_parens = function(jq_el) { var html = jq_el.html(); var processed_html = ""; var nesting_level = -160; var color; for (var i = 0; i < html.length; i++) { if (html[i] == '(') { nesting_level += 160; color = 'rgba(' + Math.min(Math.max((nesting_level % 510) - 255, 0), 255) + ',0,' + Math.min((nesting_level % 510), 255) + ',1)'; processed_html += '<span style="color: ' + color + '; text-shadow: -1px 0px 0px ' + color + '">(</span>'; } else if (html[i] == ')') { color = 'rgba(' + Math.min(Math.max((nesting_level % 510) - 255, 0), 255) + ',0,' + Math.min((nesting_level % 510), 255) + ',1)'; processed_html += '<span style="color: ' + color + '; text-shadow: 1px 0px 0px ' + color + '">)</span>'; nesting_level -= 160; } else { processed_html += html[i]; } } jq_el.html(processed_html); };rainbow_parens($('.code-body'));
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Correct prediction on native model
Similar products
My Github résumé
GitHub + Tetris = Gitris
My Attempt to Gamify Github
completeme, 't' in Github for Bash
Gitty for GitHub
GitHub Popularity Contest
A Github for writers?
We ordered dinner with GitHub at our hackathon
GitHub Treemaps
Cron for GitHub