Is there also a possibility to upload two kinds of logos for categories and choose the appropriate one depending on the selected Discourse Theme. As an example:
Light Theme: Black Logo
Dark Theme: White Logo
Thank you!
1 Like
david
(David Taylor)
March 30, 2022, 8:29am
2
I don’t think we have anything like that built-in at the moment. However, it might be possible via a theme component.
I’ve moved this question into its own topic so it gets more visibility - maybe someone else has solved this problem in the past
1 Like
pmusaraj
(Penar Musaraj)
October 7, 2022, 3:29pm
3
Thanks to @jancernik , this is now a feature in core. Like the site logo, you can now upload dark logos for categories, and they will be used when in dark mode.
discourse:main
← cernikkk:dark-mode-for-categories-logos
opened 07:03PM - 03 Oct 22 UTC
@pmusaraj suggested I open this draft because while working on this feature, I r… an into a problem I need help with.
As far as I know, the feature "works", and the icons change depending on the theme as expected.
The problem I have is the `style="--aspect-ratio"` attribute applied to the parent div of the logo.
This attribute was originally defined inside `cdn-img`, but since I had to use that component inside a picture tag, I had to move it to `category-logo`. It is also applied through the following code inside `category-logo.js` (this is the part I don't fully understand):
```javascript
@discourseComputed("width", "height")
style(width, height) {
if (width && height) {
return htmlSafe(`--aspect-ratio: ${width / height};`);
}
},
```
Since `style="--aspect-ratio"` is only set when the component is called with "width" and "height", I quickly run into a loophole. As far as I understand, it can only be solved by modifying the behavior of the previously mentioned code, which I tried with no luck.
2 Likes
system
(system)
Closed
June 23, 2023, 3:09pm
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.