Search code examples
google-chromegoogle-chrome-extensionbrowserbrowser-automationdarkmode

How to automatically toggle the Dark Reader Chrome plugin?


Question

How can we automatically toggle Dark Mode at predetermined times?

Background

Every day, around 5 PM, I switch on the dark mode of the Dark Reader Chrome extension. I toggle it off again the next morning to get more bright light in the morning.

As of now, I have remind myself everyday to hit the <Alt>+<Shift>+<D>-shortcut that I have configured in Google Chrome (chrome://extensions/shortcuts): enter image description here


Solution

  • Nowadays, toggling can be done through the new dark reader-plugin UI.

    UI-based automation

    As of writing, the plugin has 2 types of interfaces:

    1. If you see the imaged interface below, you are on the old interface and you need to enable the new UI first. Start at section Part 1: Enable the new interface.
    2. If you see an other UI, you can skip to the Part 2: Automate the UI section of this answer.

    Old interface

    Part 1: Enable the new interface

    Steps:

    1. Click on 'dev tools' (as shown above). This will open a small window.
    2. Click on 'preview new design' (as shown below). Note that as of writing, the UI of the small window doesn't visually change. Only the label of the button will change. However, when you click on the plugin icon again, you'll see the new UI.

    Enable the new interface

    Part 2: Automate the UI

    Steps:

    1. In the new interface, click on 'settings':

    The new interface

    1. Then click on 'automation':

    Click on automation

    1. Enable the ✔️ checkmark for the active times. In the example below, the browser will turn dark at 17:00 and bright at 05:00.

    Enter desired times