Skip to content
shaunpattersonPublic

About

A BeeLine reader extension that doesn't suck ass

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

Buzzline

A BeeLine reader extension that doesn't suck ass.

Buzzline applies eye-guiding color gradients to text on every webpage so your eye is pulled smoothly from the end of one line to the start of the next.

Install (unpacked)

  1. Open chrome://extensions.
  2. Enable Developer mode (top right).
  3. Click Load unpacked and select this project folder.
  4. Pin the Buzzline icon, click it, and flip the switch on.

How it works

The content script:

  1. Finds the page's main prose container (like a reader mode: the smallest element holding most of the non-link text, so file tables, link lists and sidebars are left alone; pages with no prose body are not coloured), then walks every text node in it (skipping <script>, <code>, inputs, and page chrome — <nav>, <header>, <footer>, <aside>, ARIA navigation/banner/complementary/search roles, and elements whose class or id contains junk tokens like nav, sidebar, ad, banner, promo, comment, share, byline, pagination, cookie, etc.).
  2. Finds each text node's visual line boxes with Range.getClientRects() and the character offset where each line starts by bisection, so lines are known without touching the DOM.
  3. For line index i, cuts the line into 12 colour steps interpolated between palette colour i mod N and colour (i+1) mod N (the end colour of each line matches the start of the next) and registers each step's characters as a Range with the CSS Custom Highlight API (CSS.highlights, ::highlight() rules in a constructed stylesheet). Nothing is inserted into the page: no spans, no attributes, so host scripts' MutationObservers and React/Turbo reconcilers never see Buzzline.
  4. Reapplies on window resize (the line grouping changes when text reflows) and watches the DOM with a MutationObserver (childList + characterData) to handle dynamic content.

Per-site opt-out: the popup shows the current hostname behind an "Enabled on" toggle; switch it off to skip that site. Disabled hostnames are stored in chrome.storage.sync under disabledHosts and are skipped even when the global switch is on. Tick "Only for this site" next to the scheme picker to remember a different color scheme for the current hostname.

Links inside colored text keep the gradient; their underline is drawn in a neutral grey so it does not fight it (Settings → Coloring to turn that off). On mid-tone surfaces (grey cards, tinted callouts) every palette colour is nudged toward white or black until it reaches 4.5:1 contrast.

Keyboard: Alt+B toggles coloring, Alt+S sprint-reads the selection or the page, Alt+R toggles the reading ruler, Alt+P starts or stops the pacer (change them at chrome://extensions/shortcuts). Right-click → "Sprint-read selection", "Sprint-read this page", "Open Buzzline reader" or "Pace-read from here".

Colours come from ::highlight() rules, which win over the page's own text colour and are not subject to page CSP. Requires Chrome 105+, Firefox 140+ or Safari 17.2+; without the Highlight API Buzzline stays inactive.

PDFs

A browser's built-in PDF viewer draws the page itself, so an extension cannot colour its text. Right-click a PDF → Buzzline → Open in PDF reader (or right-click a link to a .pdf → "Open link in PDF reader") opens it in Buzzline's own reader in a new tab, with two views:

  • Original: the PDF's own layout, with the gradient laid over each line of body text.
  • Reader: the text reflowed into one reading column and coloured like any web page. Text size is adjustable (+ / -), and Sprint works on it.

The reader fetches the PDF itself, which is why the manifest asks for host access to all sites. For PDFs on your own computer, either turn on "Allow access to file URLs" for Buzzline at chrome://extensions, or use Open… in the reader and choose the file. Limits: paragraphs are found by position on the page, so unusual layouts can group badly; "body text" is the document's most common text size; the dark page inverts figures too; scanned PDFs have no text to colour. The menu entry shows on every page, since the extension cannot tell a PDF tab from any other; on a non-PDF the reader says so. Adding &shades=1 to the reader's address shows a picker for the dark page colour.

Sprint (RSVP reader)

Every colored block gets a small yellow launcher icon at its start. Click it to open Sprint — an RSVP overlay that flashes one word at a time with the Optimal Recognition Point (ORP) highlighted in red and horizontally aligned on a fixed guide so your eye stays still.

"Sprint this page" reads your current text selection if there is one, otherwise the page's main prose container (nav, link lists, and hidden text are ignored; inline <code> is kept). Lone punctuation marks are merged into the neighbouring word so they never flash on their own.

Controls: play/pause (space), prev/next word (← / →), close (Esc), speed slider (150–900 WPM, default 500). Punctuation and long words get proportionally longer holds so you can catch clause boundaries; Settings lets you change the sentence/comma hold multipliers and flash 1–3 words at a time.

The Reader overlay has a "Read aloud" button (browser text-to-speech) that highlights the paragraph being spoken; click any paragraph to jump there.

Reading aids

Four aids beyond the gradient. None of them is claimed to make you read faster: the research behind each is in docs/research/reading-tools-report.html.

  • Reading ruler (Alt+R, or the popup / settings): a band that marks the line under the pointer. Styles: shade (dim the rest), bar (tint), underline; one or three lines. Alt+Up / Alt+Down move it a line. Works on any page, in the Reader, and in both PDF views. It runs even when coloring is off, but not on blocked sites. In the one controlled study (Niklaus et al., CHI 2023) a ruler sped up readers with dyslexia and did not change comprehension.
  • Pacer (Alt+P, right-click → "Pace-read from here", or the popup): a highlight moves through the page's reading text, from the selection or the top of the view, and the page follows it. One word or one line at a time. Space pauses, Left/Right step, Up/Down change speed, click text to jump, Esc stops. Unlike Sprint the text stays on screen, so you can look back. It starts at 250 wpm (settings: 100-700) and uses Sprint's pauses at commas and sentence ends. On a PDF it works in the Reader view, not Original (that text is a picture).
  • Sprint safeguards: one-word-at-a-time reading removes the look-back, and comprehension drops. Up goes back one sentence (Down forward one), the sentence around the current word shows faded while paused, and from 700 wpm a note says it suits skimming (one study found less was remembered at that speed).
  • Reader text (the Aa button in the Reader and in the PDF reader's Reader view): font (default, sans, serif, wide), size, letter / word / line spacing and column width. Nothing is on by default. Fonts are a choice, not a treatment: a 2026 meta-analysis of dyslexia fonts found no effect. Word spacing never falls below letter spacing, since widening letters alone slows reading.

Color schemes

Preset palettes cycle through four colors — each line starts in one and ends in the next, so adjacent lines share a handoff color. Every scheme has a light and a dark variant; Buzzline picks one per text block from the block's actual background (falling back to its text color), so dark-themed pages and the OS dark mode are readable without a separate scheme.

  • Classic — black / blue / black / red (dark: light gray / light blue / light gray / peach)
  • Ocean — navy / teal / navy / seafoam
  • Bumblebee — near-black / gold / near-black / brown
  • Kingfisher — black / blue / black / orange; chosen to stay distinct for colour-blind readers
  • High contrast — black / pure blue / black / pure red

What gets colored

Only long stretches of prose a person reads. Buzzline first finds the page's main prose container: it narrows into whichever section holds at least 75% of the prose, unless that would leave 400 or more characters of prose outside (so a live blog's pinned summary beside its feed of posts stays in; Reader and Sprint-page use the same container). It then scores each text block before colouring with a small MLP (BLOCK_MODEL in src/core.js: 26 features → 16 tanh units → 1, about 450 weights) on cheap features — length, link density, sentence shape, tag, width/position, whether its ancestors look like metadata, references, ads, sidebars or navigation, how much prose its neighbouring/sibling blocks hold, and the wording of its first 220 characters (paywall/newsletter phrases, prices, dates and "N hours ago", digit/capital/punctuation density). On top of that, a block is only coloured if it sits in a run of reading text — consecutive prose blocks (section headings, usernames, vote/score and timestamp rows don't break a run; ~60 characters of link titles and URLs, as between search results, do). Blocks scoring just under the model threshold (a short reader comment) join a run if they hold at least one sentence and the run already contains accepted prose adding up to roughly five sentences and 500 characters. Search results, feed snippets and isolated one-paragraph cards stay plain; articles, docs, READMEs and comment threads don't notice. Low-scoring blocks (bylines, captions, citations, listing cards, feed titles, "requested review … 1 hour ago" rows) are left untouched; blocks under 50 characters are never coloured. Ad markup (promoted, ad-type, data-ad-* attributes, <*-ad-*> elements, rel=sponsored links) and link-like custom elements are recognised directly.

The dataset holds 46.6k blocks from 643 pages of 499 sites: 246 of the 250 pages of the earlier dataset, re-crawled (news in twelve countries, docs, wikis, forums, recipes, shops, listings, feeds), plus the homepage and, where one could be found automatically (144 sites), one article of 253 popular sites from the Tranco top list (tests/e2e/sites_v4.json). Every block is labelled by System1 (TypeSafe's Jev decision model, jev-1.14.0) answering "should this block be highlighted?" as a probability, and the model fits that probability directly. The prompt was checked against the fixture pages' verdicts first (54/57 blocks; the three others are two isolated comments the reading-run rule keeps plain and one snippet at 0.50). On the re-crawled earlier pages System1 agrees with the previous LLM labels on 93% of characters, and is slightly stricter. The model is fit on 36.7k blocks from 399 sites; 100 sites are held out. The classifier alone, char-weighted precision / recall against System1 (a block counts as reading text at ≥ 0.5):

root pick only previous model MLP (shipped)
5-fold CV by site, 399 sites 0.729 / 0.940 0.918 / 0.855 0.955 / 0.841 (thr 0.60)
100 held-out sites 0.683 / 0.927 0.872 / 0.854 0.931 / 0.841 (thr 0.60)
previous 50 held-out sites, previous LLM labels 0.982 / 0.881 0.986 / 0.830 (thr 0.60)

What a reader sees also depends on the content root and the reading-run rule, so the shipped threshold (0.45) and NEAR_PROSE (0.2) were tuned on the live pipeline instead: tests/e2e/live_eval.js revisits pages with the extension loaded and scores its colouring decisions against System1, and the pair with the best live F0.5 on 79 training pages was kept (tests/e2e/data/live_tuning.json; train.js applies it while the fitted weights are unchanged and warns once they change). Live, on all 128 held-out pages:

live colouring decision vs System1 precision recall F0.5
previous model (thr 0.45, near 0.12) 0.868 0.848 0.864
shipped (thr 0.45, near 0.2) 0.844 0.877 0.851

So the retrained model colours more of the reading text than the previous one, at slightly lower precision. The MLP itself is chosen by precision-weighted F0.5 on cross-validation: wrong colouring is what readers notice. Features are recorded by the live extension itself (tests/e2e/collector.js calls the same BuzzlineBlocks code), so training and serving measure blocks identically. Rebuild end to end with node tests/e2e/crawl.js (headless Chrome, extension loaded in an isolated world), TYPESAFE_API_KEY=… node tests/e2e/label.js, node tests/e2e/build_dataset.js, node tests/e2e/train.js, node tests/e2e/live_eval.js (record the pick in live_tuning.json, rerun train.js) and node scripts/embed_model.js. Crawled text stays in the gitignored tests/e2e/data/raw/; the committed data holds per-block features and labels only, never page text. Blocks you mark "should / shouldn't be colored" from the popup are stored locally (features only) and can be exported from Settings to grow the dataset.

Performance

Colouring never mutates the page, so there is no relayout or host-observer cost; the remaining work is reading line boxes and creating Ranges, done per block, nearest-to-viewport first: ~40 ms synchronously at injection, then requestIdleCallback slices (~12 ms). Pages whose prose exceeds 150k characters only colour blocks within two screens and catch up on scroll, so the number of live Ranges stays bounded on books. Measured in headless Chromium (longest main-thread task after injection): GitHub README 53 ms, GitHub PR 96 ms, HN thread none over 50 ms, Wikipedia Honey bee 79 ms, Wikipedia Roman Empire 174 ms (first paint of its very long lead paragraphs), 720k-character Gutenberg novel none over 50 ms. The original per-character-span engine blocked for 846 ms / 3.1 s on the last two and triggered an 830 ms task in GitHub's own scripts on the README.

Known limitations

  • Does not descend into iframes or shadow DOM in this release.
  • Code blocks, inputs, and contenteditable regions are intentionally left alone.
  • Vertical writing modes (writing-mode: vertical-rl etc.) are detected and skipped — those blocks stay their original color.

Files

manifest.json          Chrome MV3 manifest
src/content.js         Colouring session (Highlight API gradient), lifecycle, Sprint launchers, Reader
src/core.js            Shared pure helpers: schemes, colour math, block model, Sprint tokenizer
src/settings.js        Storage keys, defaults, validation and edits (shared by every page)
src/blocks.js          Block features: what a text block is and what the classifier scores
src/reading.js         Reading text: content root, reading runs, Reader/Sprint extraction
src/schedule.js        Sprint schedule: chunks, ORP pivot and hold per chunk (pure, node-tested)
src/sprint.js          RSVP reader overlay: renders the schedule, timer, keys, speed slider, back-a-sentence and context peek
src/lines.js           Line geometry for the ruler: rects -> lines, band (pure, node-tested)
src/pagegeo.js         Page geometry shared by ruler and pacer: caret, text rects, scrolling
src/ruler.js           Reading ruler: band that follows the pointer, snapped to line boxes
src/pacer.js           Pacer: moving word/line highlight at a set speed, page follows
src/textstyle.js       Reader text: settings -> CSS variables (pure, node-tested) and the Aa panel
src/gradient.js        Line gradient: measured line fragments + palette -> coloured runs (pure, node-tested)
src/intents.js         Intents: what popup, context menu and keys can ask a page to do (shared sender/receiver)
src/background.js      Service worker: context menu + keyboard commands (loads core/settings/intents)
src/content.css        Base CSS + launcher + Sprint/Reader overlay styles
src/popup.html/css/js  Toolbar popup (toggle, scheme picker, per-site scheme, feedback)
src/options.html/css/js Settings page (Sprint, coloring, blocked sites, feedback export)
src/pdf.html/js        PDF reader page: Original (strips over the drawn page) and Reader (reflowed text)
src/vendor/pdfjs/      pdf.js 4.10.38 (Mozilla, Apache-2.0), unmodified: draws pages, lists their text
tests/*.test.js        Unit tests (node) and fixture-page tests (headless Chrome)
tests/e2e/             Fixture harness + pages; crawl.js / label.js (System1) / build_dataset.js / train.js training pipeline; dataset
scripts/build_firefox.js  Writes dist/firefox/ with a Firefox manifest (event page, gecko id)
icons/                 Extension icons (cropped from assets/logo.png)
scripts/gen_icons.py   Regenerates the icons (Pillow)

Dev notes

  • Store package: node scripts/package.js → dist/buzzline-<version>.zip (manifest, src/, icons/). Privacy policy: PRIVACY.md.

  • No build step. Edit files, reload the extension in chrome://extensions, reload the page.

  • Tests: node --test tests/*.test.js. tests/fixtures.test.js loads the content scripts into each page in tests/e2e/fixtures/ with a fake chrome in headless Chrome (no npm install; set CHROME_PATH if Chrome is not in a standard place, skipped when none is found). Mark fixture elements data-expect="coloured" or data-expect="plain".

  • State lives in chrome.storage.sync under enabled, scheme, disabledHosts, siteSchemes, linkUnderline, sprintWpm, sprintChunk, sprintDelays; model feedback lives in chrome.storage.local.feedback.

  • Firefox: node scripts/build_firefox.js, then load dist/firefox/ from about:debugging. Untested here — Firefox MV3 treats host permissions as optional, so enable "Run on all sites" in the add-on's settings.

  • To regenerate icons: python3 scripts/gen_icons.py.

Caveat

BeeLine Reader's gradient technique is covered by US Patent 9,026,907. Personal/educational use is generally fine; consult a lawyer before distributing publicly.

About

A BeeLine reader extension that doesn't suck ass

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages