I’ve created a theme but I don’t really want it to be usable by normal users.
Can I use a theme without selecting " Theme can be selected by users" ? (I’m an admin.)
I’ve created a theme but I don’t really want it to be usable by normal users.
Can I use a theme without selecting " Theme can be selected by users" ? (I’m an admin.)
Yes. Go to the theme’s editor and click the ‘preview’ link that’s displayed on the bottom right of the page:
I meant as the main theme, i.e. the main theme for me. Not just previewing, as previewing will go back to normal without the preview option in the URL
Admins and moderators have the .staff
class assigned to the page body, so you could do something like this in a theme:
body.staff {
// your admin theme's css here
}
A normal user could add the class staff
to their body tag (via the browser inspector) and see the theme too, but I’m not sure why anyone would bother trying that.
For more advanced themes, if you’re using a plugin outlet or changing html with template overrides (see Developer’s guide to Discourse Themes) you can do something like this:
{{#if currentUser.staff}}
<h1>hello admins and moderators!</h1>
{{/if}}
a) I do not use any CSS in my theme - simply a colour palette.
b) That would still require listing the theme as available.
You can override the color scheme with CSS (some detail here: Update themes and plugins to support automatic dark mode), otherwise you’d need to build a custom plugin to allow you to set a different theme for an admin, as it’s not an existing feature within Discourse.
The idea would be to put the admin CSS in your default theme; unless someone went digging around in your CSS you’d be the only one to see/utilize it.
Another option entirely is to use a browser plugin like stylish to set custom CSS locally.