Can anybody help me to add active theme id as
<body> CSS class?
I need to write some styles and need different attributes for some themes.
For example when using “
<html class="desktop-view not-mobile-device text-size-normal dark-theme">
We don’t use the name as an ID, just a number. You can find a theme’s ID by looking at the URL when you’re customizing a theme in the admin panel… for example
If you can get by with the ID and not the name, this would be a quick way to do it (added to your theme/component’s head file):
<script type="text/discourse-plugin" version="0.8">
var themeSelector = require('discourse/lib/theme-selector');
document.querySelector("body").classList.add("theme-id-" + themeSelector.currentThemeId())
You could also find the theme name by ID, but it would take a little more work.
Is there any document for discourse plugin and related libs methods?
I found this but it seems not to include all libs and methods:
So, you want to create Discourse themes? Not sure where to start? Or maybe you have created Discourse themes before, but want to learn how to do even more cool things. Well, you’ve come to the right place
Developer’s guide to Discourse Themes
Subjects include a general overview of Discourse themes, creating and sharing Discourse themes, theme development examples, searching for and finding information / examples in the Discourse repository, and best practices.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.