Skip to content

Instantly share code, notes, and snippets.

@hyrious
Created July 1, 2026 02:20
Show Gist options
  • Select an option

  • Save hyrious/45a9ceee35bf6db5a1fb92c499338131 to your computer and use it in GitHub Desktop.

Select an option

Save hyrious/45a9ceee35bf6db5a1fb92c499338131 to your computer and use it in GitHub Desktop.
Make npm.js code blocks render correctly in dark mode.
// ==UserScript==
// @name NPM code highlight in Dark Mode
// @namespace npm-syntax-dark.hyrious.me
// @version 2026-07-01
// @description NPM only bundles the light theme.
// @author hyrious
// @match https://www.npmjs.com/package/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=npmjs.com
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
const darkCSS = 'https://cdn.jsdelivr.net/npm/github-syntax-dark@0.5.0/lib/github-dark.css';
if (document.documentElement.dataset.colorMode === 'dark') {
GM_addStyle(`@import '${darkCSS}';`);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment