AdenFlorian / Hacker News Colored Points

// ==UserScript==
// @name       Hacker News Colored Points
// @namespace  http://AdenFlorian.com/
// @version    0.1.0
// @author     David "AdenFlorian" Valachovic <AdenFlorian@gmail.com>
// @description Colors points to make it more obvious which posts are more popular
// @match      https://news.ycombinator.com/*
// @copyright  2014+, You
// @require    https://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==

$('tr>td.subtext>span').each(function() {
    var minScore = 10;
    var score = $(this).text().replace(/[a-z]/gi, '').replace(/ /g, '');
    var newColor = 'hsla(' + (score > 120 ? 120 : score) + ', 65%, ' + Math.min(50, (score / 10) + 35) + '%, ' + Math.min(1.0, (score / 200) + 0.65) + ')';
    var newGlow = '0px 0px ' + Math.min(15, ((score - 100) / 80)) + 'px ' + newColor;
    $(this).css('color', newColor).css('text-shadow', newGlow);
});