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)
30 maart 2022 om 08:29
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)
7 oktober 2022 om 15:29
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.
main ← jancernik:dark-mode-for-categories-logos
merged 03:00PM - 07 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)
gesloten
23 juni 2023 om 15:09
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.