A Chrome Manifest V3 extension that finds likely headlines on news sites (NYTimes, WaPo, BBC, CNN) and overlays a green→red gradient based on a simple sentiment score.
- Download and unzip the archive.
- Open Chrome →
chrome://extensions. - Toggle Developer mode (top-right).
- Click Load unpacked and select the folder
headline-sentiment-highlighter. - Navigate to nytimes.com (or another supported site) and you should see colored headlines and a floating toggle.
- Runs a content script that:
- Queries for headline-like elements (
h1/h2/h3, roles, common headline classes). - Scores the text with a tiny lexicon-based sentiment (no network, no API key).
- Applies a CSS linear-gradient: green for positive, red for negative. Opacity scales with magnitude.
- Adds a small floating toggle to enable/disable coloring.
- Watches the page for new content via
MutationObserver.
- Queries for headline-like elements (
This is a lightweight prototype intended to prove out the interaction. For richer accuracy, swap the tiny lexicon for a fuller model (e.g., AFINN/Valence shifters or a cloud NLP API).
- Targets: Edit
content.js→getCandidateHeadlines()to add/removes selectors tailored to specific sites. - Color/Intensity: Tweak
colorForScore(). - Dictionary: Expand the
POSITIVE/NEGATIVEmaps with more words/weights.
- This prototype avoids external dependencies to keep the packaging simple.
- Headline markup changes frequently on news sites; updating selectors may be needed.