The discussion revolves around customizing the category list page in Discourse to add “pills” and remove the left border. The user, tjot, is trying to access the category color stored in a template file, but it’s not easily accessible from CSS. awesomerobot suggests moving the colors to CSS custom properties, making them accessible, but this is not currently implemented.
In the meantime, tjot has found a workaround by overriding the components/parent-category-row template. However, this approach may break if the template changes in the future.
An alternative solution is proposed by saquetim, who suggests using a CSS hack to achieve the desired effect without overriding templates. This approach applies the style directly to the h3 element of the title, which is a direct child of the td element with the inline style.
What we could do is move these colors to CSS custom properties instead of setting them inline, which would make the colors easily accessible in any CSS/SCSS. I don’t know when we’ll be able to get to that, but I’ll keep it on my list of to-dos.
That would be awesome
BTW is there any other way to achieve the view I want?
I’ve read that I can override templates for specific parts of Discourse, which template file I must override and how should I do that in my custom theme?
Note that I’ve applied the style directly to the h3 element of the title because it is a direct child from the td in which the inline style was applied. So if the template ever get rid of it you will have to tweak your CSS.
But you can skip overriding the components/parent-category-row as you wanted.