The year 2019 started the process of spreading dark themes on websites, in desktop and mobile applications, as well as in the operating systems themselves. The following year brought access to this facility in all popular products of major importance on the market. The dark theme is less tiring to eyes (especially in worse lighting conditions), and also allows you to save energy in OLED and AMOLED screens.

Let’s look at possible approaches to implement the dark theme.

What theme should the user serve by default?
We can approach this in several ways:

  • use the default bright theme, with the option of manual change in the settings menu by the user (the most common variant on websites),
  • use the system settings (if we have access to such information in a given environment), apply the theme that is used in the system (often used in mobile applications),
  • take into account the time zone in which the user is – use a light theme during the day, and dark at night (in this case it must be possible to enable/disable this functionality, not every user will feel comfortable with such a solution).

Which of the following approaches to choose? The decision must be made individually, depending on the type of application, the type of content presented, the target group of users, the possibilities of the platform used, existing customer habits.

It is important to save the setting selected by the user in persistent storage so that changes do not reset between visits to the application. In the absence of a user account, the settings can be stored on the visitor’s machine (e.g. LocalStorage), in the second case it is worth saving them on the application server.