Icons don't show up in the sidebar then the color isn't defined

AI-generated summary

A user, nolo, reported that icons in the sidebar do not show up when the color is not defined. They suggested that icons should show with the default icon color for the sidebar, allowing users to define a static color if desired. pmusaraj agreed and invited a pull request (PR) to fix the issue. nolo submitted a PR, which was merged by pmusaraj. However, this change caused icons with defined colors to render in gray. md-misko pointed out the issue and requested a test for categoryColour to avoid breaking existing definitions. Don suggested a workaround by removing the categoryColor field. nolo acknowledged the issue and submitted another PR to fix the regression.

Love that icons show on the sidebar now! :sunny: :sunglasses:

What seems a small glitch: Icons don’t show, when the color is not defined. E.g. on this screenshot the first category has an icon defined, but no color. Then the icon is not shown:

The downside to defining all icons with colors is that icons then won’t show with inherited colors on the list views (accent when the topic is unread/ dimmed down when the topic is read). E.g. here the Announcements icon shows with inherited color, while as the icon with defined color always stays the same:

I think icons should just show on the sidebar with the default icon color for the sidebar. Then it’s up to the user if they want to define a static color or not.

4 Likes

Sorry for the delay here @manuel, this makes sense, I added a pr-welcome tag to the topic, I’m open to looking at a PR that fixes this issue. Thanks!

3 Likes

Did a simple PR for this: FIX: Render sidebar icons when no color is defined by nolosb · Pull Request #32 · discourse/discourse-category-icons · GitHub

7 Likes

Thanks, fix is now merged!

6 Likes

Unfortunately, this change now renders all icons with defined colours in gray.

I’m using

category,icon,categoryColour
2 Likes

Yeah, now it use it by default if you leave empty the color. With remove categoryColor works for me.
like this: category,icon

2 Likes

Yes, but it breaks the existing definitions (I have quite a few).

@manuel Would you be so kind and include the test for categoryColo(u)r so that we don’t need to manually fix all definitions in all existing instances? Thanks in advance!

4 Likes

Ok, there’s quite some stuff going on here with colors :upside_down_face:

So actually the declaration is obsolete on both the default badges and on the sidebar. Just on the default badges it fails silently as it’s applied to an inline style:

Did a PR for the sidebar regression: FIX: Render legacy color declaration by nolosb · Pull Request #34 · discourse/discourse-category-icons · GitHub

4 Likes