How To Add Dark Mode Toggle to Your Website How To Add Dark Mode Toggle to Your Website | RaQMedia | Complexity Simplified

How To Add Dark Mode Toggle to Your Website


You May Also Like

How do I add a dark theme to my website?

What is Dark Mode / Night Mode?

As we all know, the use of mobile phones and laptop have become one of the most common routines in our life. Consequently, most of us use it obviously at night. Unfortunately, if you do so , you may have eyeache especially if you spend long hours in front of the screen at night.

Why Should You Add a Dark Mode Toggle

Having such a feature in your website - regardless of the platform you are using Blogger or WordPress - will add a bunch of advantages:

  1. A professional impression for your website.
  2. Better user experience.
  3. Increase the bounce rate as visitors will stay longer because they feel more comfortable reading your content.

How To Add Dark Mode Toggle to WordPress

The dark mode toggle has been introduced to WordPress few years ago. That's why there are several plugins that provides this option with just few click of installation. Raqmedia has reviewed the most popular ones. Here are the free plugins that we recommend:

How do I add a dark theme to my website?

This awesome feature is also introduced to the Blogger platform. You just need to make some adjustments by injecting some lines of code into your Blogger template. To do so, follow our four-step guide below.

Step 01

First, follow these steps to get your template ready:
  1. Login to you Blogger dashboard.
  2. Backup your template first.
  3. Head to Template then edit HTML.
  4. With Ctrl+C to copy and Ctrl+V to paste the following codes in their appropriate places.
  5.  Search for the line of code by hitting Ctrl+F
  6. Save your template and exit.;

Step 02

Next paste the following code just before </head>

[<style type='text/css'>
/* Night Mode By*/
.togglenight + .togglenight-btn{outline:0;display:inline-block;width:45px;height:10px;position:relative;cursor:pointer;margin-right:5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
.togglenight + .togglenight-btn:after,.togglenight + .togglenight-btn:before{position:relative;display:block;content:"";width:50%;height:100%}
.togglenight-switch + .togglenight-btn{background:#d5d2fc;border-radius:99em;transition:all .4s ease}
.togglenight-switch + .togglenight-btn:after{content:'';border-radius:100px;background:#887fff;transition:right 0.3s cubic-bezier(0.175,0.885,0.32,1.275),padding 0.3s ease,margin 0.3s ease;position:absolute;width:20px;height:20px;top:-5px;right:0;box-shadow:0 3px 6px rgba(0,0,0,0.16),0 3px 6px rgba(0,0,0,0.23)}
.togglenight-switch:checked + .togglenight-btn{background:rgba(255,255,255,.15)}
.togglenight:checked + .togglenight-btn:after{content:'';right:55%;background:#ff9f43}
.nightmode a{color:rgba(255,255,255,.7)!important}
.nightmode a:hover{color:rgba(255,255,255,.4)!important}
.nightmode .class-baru{}
.nightmode .class-baru{}

Step 03

Now, search ]]></b:skin> line and paste the following CSS code just above that ]]></b:skin>.
[.Switchbtn{position:fixed;text-align:center;display:inline-block;align-items:center;z-index:100;left:20px;top:20px}.Switchbtn{top:10px;left:80px}}@media screen and (max-width:480px){.Switchbtn {left:50px}.nightly{display:none}}@media screen and (max-width:240px){.Switchbtn{display:none}}]

Step 04

After that search for <body/> tag and PASTE the below code just before it.

[<div class='Switchbtn'>
<span class='nightly'>الوضع الليلي</span> <input class='togglenight togglenight-switch' id='nightmode' type='checkbox'/>
<label class='togglenight-btn' for='nightmode'/></div>
<script type='text/javascript'>
// Night Mode

How to Add Blogger Widgets or Components into Dark Mode With CSS

After carrying the previous steps, you may notice that some parts of your template is not affected by the script and does not shift to Night mode. To fix this problem, you need to add these items or Class Ids using the following Css line. Just change .header with your new Class / item Id, you can also adjust the color to your favourite one.

[.nightmode .header{background:#222}]

Important Notice For Blogger Users

 Note: The Night Mode script may not work for all the blogger templates. Always backup your template before making any changes.
🔔 Subscribe to our channel to get exclusive & free tech tips & hacks 🔔

Eh! Voila! you have successfully added a stylish dark mode toggle to Blogger or WordPress. If you face any problems or find ways to improve this script or better WordPress Plugins, do share your thoughts and feedback.

We love to hear from you 😊💗.



Android,13,Android Apps,1,Apps,2,Around-The-World,14,Articles,11,Autos,4,Blogger,16,Blogging,32,Celebrities,9,Classroom-Ideas,4,Dictionaries,1,DIY,57,Earn-Money,10,English-Club,1,English-Exercises-Online,4,Entertainment,48,ESL-Games,6,Facebook,11,Freebies,5,Fun,21,Girls-stuff,41,Grammar,10,Health,35,Imaniat,66,Kids,44,Learn-Arabic,20,Learn-English,72,Lesson-Plans,1,Lifestyle,138,Listening,1,Methodology,13,Motivation,9,Mysteries,14,News,32,Online-Tools,4,Personality,2,Photoshop,8,Printables,25,Pronunciation,3,Qasas-ul-Anbiya,23,Qasas-ul-Quran,7,Quizzes,10,Rawae,18,Realities,17,Reviews,13,SEO,8,Services,3,Sira,24,Stories,1,Students-Corner,4,Teach-English,24,Tests,7,Travel,14,Tutorials,92,Vocabulary,40,Windows,5,Women,41,WordPress,8,Writing,1,YouTube,24,شروحات تقنية,14,
RaQMedia | Complexity Simplified: How To Add Dark Mode Toggle to Your Website
How To Add Dark Mode Toggle to Your Website
Add a free dark mode toggle to your website. Create a dark theme for your Blogger or WordPress website easily in few clicks. Follow Raqmedia guide and give your business blog a fancy look with a night mode widget.
RaQMedia | Complexity Simplified
Loaded All Posts No posts are found VIEW ALL Read more Reply Cancel reply Delete By Home PAGES POSTS View All You May Also Like - قد يعجبك أيضا LABEL ARCHIVE SEARCH ALL POSTS Sorry! No posts were found matching your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Click Here To Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Contents