szq2 / Hacker News Colored Points

// ==UserScript==
// @name       Hacker News Colored Points
// @namespace  http://AdenFlorian.com/
// @version    0.2.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/*
// @updateURL  https://openuserjs.org/meta/szq2/Hacker_News_Colored_Points.meta.js
// @downloadURL https://openuserjs.org/install/szq2/Hacker_News_Colored_Points.user.js
// @license    MIT
// ==/UserScript==

document.querySelectorAll('span.score').forEach(function(el) {
    let minScore = 10;
    let score = Number.parseInt(el.innerText, 10);
    let newColor = 'hsla(' + (score > 120 ? 120 : score) + ', 65%, ' + Math.min(50, (score / 10) + 35) + '%, ' + Math.min(1.0, (score / 200) + 0.65) + ')';
    let newGlow = '0px 0px ' + Math.min(15, ((score - 100) / 80)) + 'px ' + newColor;
    el.style = 'color: ' + newColor + '; text-shadow: ' + newGlow;
});