GitHub apply dark theme on private repo

Apply dark theme to your private repository pages on Github

  1. // ==UserScript==
  2. // @name GitHub apply dark theme on private repo
  3. // @namespace https://github.com/benok/
  4. // @description Apply dark theme to your private repository pages on Github
  5. // @include https://github.com/*
  6. // @version 2022.01.31.0
  7. // @homepage https://gist.github.com/benok/301f7a9667a598202f10111af054ae77
  8. // @author benok
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. if (document.querySelector('span.Label.Label--secondary').textContent == "Private") {
  17. document.querySelector('html').setAttribute('data-color-mode', 'dark');
  18. }
  19. })();