gormus
(Osman Görmüş)
23.Декабрь.2025 12:44:05
1
Компонент темы Значки тегов позволяет настраивать отображение тегов со значком и, при желании, с цветом. Я действительно считаю, что эта функция имеет значение, особенно когда приходится управлять большим количеством тегов.
В моём случае использование цвета как для текста, так и для значка, а также добавление фона увеличило бы видимость и обеспечило бы лучшее визуальное разделение от остальных тегов и групп тегов.
Я отправил запрос на включение изменений (pull request), чтобы показать, как, по моему мнению, это могло бы работать.
main ← gormus:add-background
merged 04:05PM - 26 Jan 26 UTC
Please see the _Feature_ topic at https://meta.discourse.org/t/add-backgroundcol… or-option-for-tag-icon-theme-component/391995
---
This pull request enhances the tag icon feature by improving how tag icons, colors, and backgrounds are rendered and configured. It streamlines the tag rendering logic, ensures consistent styling through CSS variables, and expands the configuration format to support both icon and background colors for tags.
**Tag rendering and configuration improvements:**
* Refactored the `iconTagRenderer` function in `tag-icons.js` to use the shared `defaultRenderTag` utility, simplifying the code and ensuring consistent tag markup generation. Tag icons, colors, and backgrounds are now applied by parsing the rendered tag and injecting the icon and CSS variables directly.
* Updated the tag icon configuration format in the theme settings and code to support four fields: `tag-slug,icon,color,backgroundColor`, allowing both icon and background colors to be set for each tag. [[1]](diffhunk://#diff-847d4476f4d777f46cf45f4b203b31c3c98a7ff363ba122ac5bd8c256f1f38d2L4-R4) [[2]](diffhunk://#diff-c0ba113d8a0d1fa107bb6ef026a3926c5840e6de37c3517ba7e510b2c4ad21e6R51-R103)
**Styling enhancements:**
* Added new CSS rules in `common.scss` for `.discourse-tag.colored-tag` and `.hashtag-cooked:has(.hashtag-tag-icon)`, ensuring that colored tags and hashtag icons use the configured CSS variables for color and background, improving visual consistency.
**Hashtag icon logic:**
* Improved the hashtag icon rendering in `TagHashtagTypeWithIcon` to use the configured icon and color, and added support for custom background color.
**Tag style: `simple`**
<img width="1470" height="801" alt="tags,tag_style=simple,light" src="https://github.com/user-attachments/assets/3d409866-7635-42ed-a8b9-1777a948b048" />
**Tag style: `bullet`**
<img width="1470" height="801" alt="tags,tag_style=bullet,light" src="https://github.com/user-attachments/assets/6e4752d9-04ec-4be3-acd9-95f9481df735" />
**Tag style: `box`**
<img width="1470" height="801" alt="tags,tag_style=box,light" src="https://github.com/user-attachments/assets/433cc97c-7a33-4a18-82eb-ce09160e4719" />
Стиль тега: simple
Стиль тега: bullet
Стиль тега: box
5 лайков
pmusaraj
(Penar Musaraj)
26.Январь.2026 16:06:23
2
Это уже объединено, спасибо за ваш вклад @gormus !
4 лайка
gormus
(Osman Görmüş)
26.Январь.2026 16:14:16
3
Отлично! Спасибо @pmusaraj
4 лайка