Simple Dark Mode

Simple Dark Mode for any site

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         		Simple Dark Mode
// @description                 Simple Dark Mode for any site
// @namespace    		http://your.namespace.com
// @version      		0.01
// @author       		bunny777
// @grant        		none
// @match        		*://*/*
// @license MIT
// ==/UserScript==

(() => {
  'use strict';

  const toggleButton = document.createElement('button'),
    style = document.createElement('style');

  toggleButton.innerText = 'ON';
  toggleButton.style.position = 'fixed';
  toggleButton.style.width = '30px';
  toggleButton.style.top = '5px';
  toggleButton.style.right = '5px';
  toggleButton.style.padding = '5px';
  toggleButton.style.border = 'none';
  toggleButton.style.borderRadius = '20px';
  toggleButton.style.backgroundColor = '#000000';
  toggleButton.style.color = '#ffffff';
  toggleButton.style.fontSize = '10px';
  toggleButton.style.cursor = 'pointer';
  toggleButton.style.boxShadow = '2px';
  toggleButton.style.zIndex = 9999;
  document.body.appendChild(toggleButton);

  function darkMode() {
    style.innerText = 'html,img,video,button,svg:not(button svg),canvas {filter: invert(.9);}';
    document.head.appendChild(style);
  }
  darkMode();

  document.addEventListener('DOMContentLoaded', darkMode);
  toggleButton.addEventListener('click', () => {

    if (style.innerText === 'html,img,video,button,svg:not(button svg),canvas {filter: invert(0);}') {
      style.innerText = 'html,img,video,button,svg:not(button svg),canvas {filter: invert(.9);}';
      toggleButton.innerText = 'ON';
    } else {
      style.innerText = 'html,img,video,button,svg:not(button svg),canvas {filter: invert(0);}';
      toggleButton.innerText = 'OFF';
    }
    document.head.appendChild(style);
  });
})();