Greasy Fork is available in English.

Hacker News Points & Comments Highlighter

Highlight points and comments on Hacker News with different colors based on their values

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Hacker News Points & Comments Highlighter
// @namespace    http://tampermonkey.net/
// @icon         https://news.ycombinator.com/favicon.ico
// @version      0.1.1
// @description  Highlight points and comments on Hacker News with different colors based on their values
// @author       RoCry
// @match        https://news.ycombinator.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Color functions
    function getPointsColor(points) {
        if (points >= 500) return '#FF4500';      // Bright red-orange
        if (points >= 250) return '#FF6B21';      // Orange
        if (points >= 100) return '#FF8C42';      // Light orange
        if (points >= 50)  return '#FFA563';      // Pale orange
        return '#FFB584';                         // Very pale orange
    }

    function getCommentsColor(comments) {
        if (comments >= 300) return '#1E88E5';    // Bright blue
        if (comments >= 200) return '#42A5F5';    // Blue
        if (comments >= 100) return '#64B5F6';    // Light blue
        if (comments >= 50)  return '#90CAF9';    // Pale blue
        return '#BBDEFB';                         // Very pale blue
    }

    // Highlight points
    document.querySelectorAll('.score').forEach(score => {
        const points = parseInt(score.innerText);
        if (!isNaN(points)) {
            score.style.color = getPointsColor(points);
            score.style.fontWeight = 'bold';
        }
    });

    // Highlight comments
    document.querySelectorAll('a').forEach(link => {
        if (link.href.includes('item?id=') && link.innerText.includes('comment')) {
            const comments = parseInt(link.innerText);
            if (!isNaN(comments)) {
                link.style.color = getCommentsColor(comments);
                link.style.fontWeight = 'bold';
            }
        }
    });
})();