GitHub Gist apply dark theme on secret Gists

Apply dark theme to your secret Gists on GitHub Gist

  1. // ==UserScript==
  2. // @name GitHub Gist apply dark theme on secret Gists
  3. // @namespace https://github.com/benok/
  4. // @description Apply dark theme to your secret Gists on GitHub Gist
  5. // @include https://gist.github.com/*
  6. // @version 2022.01.31.0
  7. // @homepage https://gist.github.com/benok/69b98fc38aa5884234fe50326ef014ae
  8. // @author benok
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. if ( (document.querySelector('span.Label.v-align-middle')||
  16. document.querySelector('span.Label.Label--secondary')/* Editing page */).textContent.includes('Secret')) {
  17. document.querySelector('html').setAttribute('data-color-mode', 'dark');
  18. }
  19. })();