Есть ли также возможность загружать два вида логотипов для категорий и выбирать подходящий в зависимости от выбранной темы Discourse? Например:
Тема «Светлая»: чёрный логотип
Тема «Тёмная»: белый логотип
Спасибо!
david
(David Taylor)
30.Март.2022 08:29:22
2
На данный момент, думаю, у нас ничего подобного встроенного нет. Однако это, возможно, можно реализовать через компонент темы.
Я переместил этот вопрос в отдельную тему, чтобы он получил больше внимания — возможно, кто-то другой уже решал эту проблему раньше
pmusaraj
(Penar Musaraj)
07.Октябрь.2022 15:29:26
3
Благодаря @jancernik , это теперь функция ядра. Как и логотип сайта, теперь вы можете загружать тёмные логотипы для категорий, и они будут использоваться в тёмном режиме.
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.