Skip to content

Dark mode theme #40

@mad-briller

Description

@mad-briller

Hey there, me again!

It would be great if Doctum supported a dark mode theme out of the box.

Many modern documentation sites etc. ship with the ability for either the user to toggle the theme or for it to respect the user's preference using the prefers-color-scheme media query.

Would this be difficult to achieve in Doctum by default? I looked into the css in use and it seems that the theme was generated using a bootstrap theme generation utility, it would be possible to generate an alternate theme that is dark and then swap these out at run-time, but you would lose the ability to use the media query provide the user with their preference.

Another approach is to replace all color values with css variables and re-assigning those inside the media query:

:root {
  --bg-primary: #fff;
 }
 
@media (prefers-color-scheme: dark) {
  :root {
  --bg-primary: #000;
 }
}

This secondary approach would probably require a lot more work as it would require changing the theme generated by the external tool, and making everything a css variable, but it would provide the best user experience and require no javascript to modify classes or swap out script tags.

Let me know if you have any thoughts, and thanks for your time.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions