Out-of-the-box dark/light theme selection

AI-generated summary

Out-of-the-box dark/light theme selection will be available in the upcoming release, a feature requested by @codinghorror. This change adds two default themes when none exist, allowing users to choose between them.

  • For sites with existing themes, manual setup is required to enable user-selectable themes.
  • Deleting all themes will restore the default “stock” themes upon migration. Alternatively, themes can be marked as non-user-selectable or custom themes can be created.

Future plans include developing a Large Font theme, as mentioned by sam.

For our upcoming release @codinghorror really wanted dark/light/large font theme selection out of the :card_box:

Following this commit our default installs will have this enabled:

https://github.com/discourse/discourse/commit/342ef5f81a34dc6d79b4d12b4533ed764ea21510

How it works?

  • When database is seeded (happens every time migrations run) we check how many themes exist.

  • If 0 themes exist, we will seed 2 themes, a default one and a dark one, we mark both themes as user selectable.

What this means to you?

  • If you already have themes and theme components defined you will have to follow the official howto to create the selectors. We can not safely provide this option to you cause you already started customizing and there is high likelihood we will mess stuff up. (what if you have theme components, what if you already have this defined, etc)

  • If you delete all your themes, the “stock” themes will re-appear magically next time you migrate. So instead, if you do not care for the feature just mark the themes as not user selectable or create your own theme.

What is next?

I am going to try to cobble up a Large Font theme.

15 Likes