---
title: "How to keep dark mode for the Knowledge base site by default"
slug: "how-to-keep-dark-mode-for-the-knowledge-base-site-by-default"
description: "You can use the Light or Dark option at the top of the article to change the theme. "
tags: ["Customization"]
updated: 2025-12-29T09:42:33Z
published: 2026-01-31T09:30:11Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.document360.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to keep dark mode for the Knowledge base site by default

You can use the Light or Dark option at the top of the article to change the theme. If you want to enable the Dark by default, you can use the below solution.

> [!NOTE]
> ** NOTE
> 
> By default, all articles would be in Light mode.

### Solution

1. Navigate to **Settings** (<nor class="fa-solid fa-gear" data-tomark-pass=""></nor>) > **Knowledge base site** > **Site customization** > **Custom CSS & JavaScript** in the Knowledge base portal.

![Site customization options including CSS, JavaScript, and theme settings for a knowledge base.](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/Custom%20css%20&amp;%20js.png)
2. From the left navigation pane, click on the **JavaScript**tab and paste the following Javascript snippet:

```javascript
$(document).ready(function() {
setTimeout(function() { document.getElementById('darkTheme').click(); }, 100); 
});
```

1. Click **Save**.

![JavaScript code snippet demonstrating a function to trigger dark theme on page load.](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/Dark%20mode%20for%20KB.png)
2. Now, all the articles on your site appear in dark mode by default.

However, the user can switch to light mode with the **Light** option at the top of the article.
3. If you want the user to view only in dark mode, you can turn off the **theme option** in Article settings.
  1. Navigate to **Settings** (**) > **Knowledge base site** in the left navigation bar****in the Knowledge base portal.
  2. In the left navigation pane, navigate to **Site customization**.
  3. Under the **Site theme** section, select the **Dark only** option and click **Save** at the top.

![Site customization options for theme selection and branding in a knowledge base portal.](https://cdn.document360.io/860f9f88-412e-4570-8222-d5bf2f4b7dd1/Images/Documentation/Dark%20mode%20site%20customization.png)
