Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Headline Sentiment Highlighter (Prototype)

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.

Install (Developer Mode)

  1. Download and unzip the archive.
  2. Open Chrome → chrome://extensions.
  3. Toggle Developer mode (top-right).
  4. Click Load unpacked and select the folder headline-sentiment-highlighter.
  5. Navigate to nytimes.com (or another supported site) and you should see colored headlines and a floating toggle.

How it works

  • 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.

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).

Customize

  • Targets: Edit content.jsgetCandidateHeadlines() to add/removes selectors tailored to specific sites.
  • Color/Intensity: Tweak colorForScore().
  • Dictionary: Expand the POSITIVE / NEGATIVE maps with more words/weights.

Notes

  • This prototype avoids external dependencies to keep the packaging simple.
  • Headline markup changes frequently on news sites; updating selectors may be needed.

About

Chrome Extension using NLP to analyze the overall vibe of a webpage and generate an applicable CSS based on whether the news is positive or negative.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages