Dark Switch

Change Theme Anywhere

v0.2.3

Wishing for dark mode and other themes?

Dark Switch can force any website to cycle through your desired theme. Save or drag the big Dark Switch button (you saw above) to your bookmark. You may also create new bookmark containing the following script.

javascript:(a=>{d=document;x=d.$ds||0;c=a[x=x>=a.length?0:x];b=c[0]||'0';p=c[2]||'grey';h=c[1]||p;i=c[3]||'#47B';d.querySelectorAll('html,body,body *:not(noscript,script,style,link,br,hr,mark,i,svg,input,select,meter,progress,pre *)').forEach(e=>{t=e.tagName;C=r=>r.test(t);e.style.background=t=='HTML'?b:'inherit';e.style.color=C(/^A$|BUTTON$/)?i:C(/^P(RE)?$/)?p:h});d.$ds=++x})([['#222','#DDD'],['#DDD','#222']])

Customize themes

You can customize what you want Dark Switch to apply. A theme consist of 4 colors. // default were used if not specified

// theme   = [background,text,paragraph,link]
var dark   = ['#222','#DDD'];
var light  = ['#DDD','#222'];
var blue   = ['#036','#ABC','#68B','#5A4'];
var red    = ['#111','tan','grey','#E22'];
darkswitch( [dark,light,blue,tan] ); // cycle through themes
darkswitch( [dark] ); // apply specific theme

Examples · Dark · Light · Blue · Tan · Red

Contribute

Follow this project on GitHub. Have great ideas to talk about or just wanna chat ? .. Lets discuss about it. Found bugs ? file an issue.

❤️ If you use this work and liked it, please consider supporting.

License

MIT licensed - nikahmadz