Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LearnCpp Dark

A dark theme for learncpp.com, as a Chrome extension (Manifest V3).

The tutorials are long and the site is bright. This themes the whole thing — content, chrome, tables, forms, the comment section, the code samples — behind a one-click toggle.

Dark theme applied to a lesson page

Before

The same page without the extension

Install

Not on the Chrome Web Store — load it unpacked:

  1. Clone or download this repo
  2. Open chrome://extensions
  3. Turn on Developer mode (top right)
  4. Load unpacked → select the folder
  5. Visit any page on learncpp.com

Click the toolbar icon to toggle it off and on. The setting syncs across your Chrome profiles.

How it works

Five files, no build step, no dependencies.

File Role
manifest.json MV3 manifest. Matches *://*.learncpp.com/*, storage permission only
dark.css The whole theme. Every rule scoped under html.lcd-dark
content.js Adds/removes that one class
popup.html / popup.js The toggle

Two details worth calling out, because they're the parts that are easy to get wrong:

No white flash. The content script runs at document_start and adds lcd-dark immediately — before reading storage — then reconciles with the stored setting. Waiting for the async storage read first means a full white page render on every navigation.

The toggle is a class, not a stylesheet swap. dark.css is always injected; everything in it is scoped under html.lcd-dark. Toggling adds or removes that class, and a storage.onChanged listener applies it to open tabs live, with no reload.

Colours are CSS custom properties on html.lcd-dark — retheme it by editing the handful of variables at the top of dark.css.

Known limitations

Ad iframes stay light. The page embeds Google AdSense frames from googleads.g.doubleclick.net. A content script can only inject into frames matching its own matches pattern, so a cross-origin ad frame is out of reach by design — the extension cannot style what's inside it, and no CSS can. On a lesson page this shows up as a bright "Discover more" panel in each sidebar.

The <iframe> element itself can be dimmed from outside (a filter on the element), which takes the edge off without touching its contents. Not currently applied.

Styling is selector-based. It targets the site's current markup, so a redesign would need rules updated. The trade-off is deliberate: a generic inverting filter works everywhere and looks wrong everywhere, especially on syntax-highlighted code.

Licence

MIT — see LICENSE.

Not affiliated with learncpp.com. It restyles pages in your own browser and changes nothing on the site; the tutorials themselves are free and excellent, and worth supporting.

About

A dark theme for learncpp.com — Chrome MV3 extension, no build step, no dependencies. Flash-free at document_start, toggled by a class.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages