I am porting an older forum onto discourse and the original site had a unique theme (including unique header logo) for one of their categories.
My current solution is a theme-component that looks something like this:
///replace the #hexcodes with the color values of your choice
///continue for any/all required color values
<script type="text/discourse-plugin" version="0.2.0">
var logo = document.getElementById("site-logo");
var categories = document.getElementsByClassName("category-target-category");
if(categories.length > 0)
logo.src = "category-specific-logo-url";
logo.src = "standard-logo-url";
Currently, I have to iterate through every possible color value mentioned in color_definitions.scss in order to override them. I believe that the values for this file are produced foundation/color_transformations.scss, which generates them from the values found in foundation/colors.scss. I know that you can override the root color theme values either via the admin menu or in the about.json of the theme-component, but I believe these changes take place site-wide.
Is there a more efficient way to customize a specific category aside from listing out all of the 100+ variables in color_definitions.scss? For instance can the foundation/colors.scss file be modified via a theme-component?
If you simply create a new theme, you can add code and upload the logos as assets. <category-slug> is the lower case category name that appears in the URL field of the browser (separate parent and subcategories with “-” dashes, as in parentcategory-subcategory.
There are also various theme-component’s like this one that you could search for
I really appreciate the css instructions for the logo. Way more elegant than my clunky script.
Your solution will absolutely work for my use case. Although selecting every element and directly coding the color for it seemed tedious. I’m wondering if theres a way to take advantage of the mechanism that discourse uses to generate its color palette from the only 12 or so base colors found in colors.scss. I think doing so may require a plugin rather than a theme component, and that is a challenge for a different day.