Dark mode for non logged in viewer

Hi,

I host an instance of Gitlab with Docker. It works fine. The dark mode is working fine as soon as I am authenticated. My question is how to set the dark mode theme even when we are not logged in?

Thanks
Pierre

Hi,

Edit /etc/gitlab/gitlab.rb, the section you are looking for:

### Default Theme
### Available values:
##! `1`  for Indigo
##! `2`  for Dark
##! `3`  for Light
##! `4`  for Blue
##! `5`  for Green
##! `6`  for Light Indigo
##! `7`  for Light Blue
##! `8`  for Light Green
##! `9`  for Red
##! `10` for Light Red
# gitlab_rails['gitlab_default_theme'] = 2

so if you wanted Dark mode, just uncomment the last line, since it’s already set to 2. You then need to run gitlab-ctl reconfigure.

What @iwalker writes is right for now, but may change soon, as

is merged now.

1 Like

Hi,
it did not work?

root@gitlab:/# cat etc/gitlab/gitlab.rb | grep gitlab_default_theme
gitlab_rails['gitlab_default_theme'] = 2
root@gitlab:/# gitlab-ctl reconfigure
[2024-03-08T10:36:57+00:00] INFO: Started Cinc Zero at chefzero://localhost:1 with repository at /opt/
...
gitlab Reconfigured!

Regards
Pierre

Hi,
after adding this change, the method described here stopped working. Apparently this is the latest discussion on this topic. Moving the dark theme to a separate code unit to support Navigation theme was most likely the reason. It affected the functionality of setting the default dark theme for unauthorized users. Perhaps someone knows how to solve this problem? For example for Syntax highlighting theme you can use the instance database to prescribe a default value.

Changelog 16.10.0
Resolve validation failing for theme_id when previous dark mode value 11 (merge request)