Dark mode for Shopify

You add the line once to your theme's main layout file, theme.liquid, and it is on every page of your store.

Before you start

  • Make a copy of your theme first, so that you can go back: in Online Store, then Themes, open the menu next to your current theme and choose Duplicate.

Add DarkYes to your Shopify store

  1. Create a free DarkYes account and add your site's address. In your dashboard, press Get the code next to the site, then Copy code.

    Your line looks like this, with your own key in place of YOUR-KEY:

    <script src="https://darkyes.com/d.js" data-key="YOUR-KEY" async></script>
  2. In your Shopify admin, go to Online Store, then Themes.

  3. Next to your current theme, open the menu and choose Edit code.

  4. In the Layout folder, open theme.liquid.

  5. Find the line </head> and paste your line just before it.

  6. Press Save.

When you update your theme to a new version, Shopify makes an updated copy without your own code changes. Paste the line again in the new copy.

Checkout pages keep Shopify's own look.

Check that it works

  1. Open your site in a private window.

  2. Look for the switch in the bottom-right corner, and press it.

  3. In your dashboard, the site changes from “Waiting for the first visit” to “Active”.

Remove it

Open theme.liquid again, delete your line, and press Save.

Your site then looks exactly as it did before.

These steps were checked against the Shopify Help Center and Shopify's theme documentation on 14 November 2026.

Try it on your own site.

Create a free account, add your site and paste one line. When your first site goes live, you get 14 days of Pro for free.

Start freeNo card needed.