Created
July 1, 2026 02:20
-
-
Save hyrious/45a9ceee35bf6db5a1fb92c499338131 to your computer and use it in GitHub Desktop.
Make npm.js code blocks render correctly in dark mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==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