Category color selection should be allowed even when style is "none"

In category settings, I see the message “You can’t select colors because you have a category style of none.” However, it’s used by the Category Icons theme component, and that works quite nicely with “none” as the style.

My current work-around is to change the style setting, quickly set the category color, and quickly set it back. But that’s kind of silly. Please just allow it to be set (maybe with a note that it won’t change the color unless a theme does something with it, instead of hiding the setting). Thanks!

2 Likes

In the Category Icons component, you can use a HEX color for the icon. The icon color defaults to the category badge color only when using the special keyword “categoryColor”. Is there any reason you can’t use a HEX value in the theme component’s settings?

1 Like

I find it much nicer to maintain and manage the category colors in the category setting rather than in the components setting list — so categoryColor is perfect. (And as noted, it actually works with “none” as the style, I’m just prevented from editing it.)

1 Like

It does indeed work, but I hesitate to amend core when style none is set for categories given that the colors in the category settings will only be used if this theme component is installed and each row in its settings is set to default to categoryColor. In other words, it’s a very specific use case.

Plus, the preview in the category edit screen in core doesn’t include the theme component’s icon, so when choosing a color the user wouldn’t see any changes in the preview.

1 Like

It could be this theme component or any other that does something with category color, right? For example Discourse Category Banners or Colorful categories component. So I think it’s not really that narrow of a use case. And those don’t all have the work-around of a configuration option for the theme component.

2 Likes

Oh, plus — I want to pick from the palette, and have the indicators show what’s taken already. That’s really nice! Can’t do that with the component hex color config.

2 Likes

I’d also like to make the point that it’s actually not such a specific use case.

Just as @mattdm already pointed out, the color is not only used in the badges or the icons. It can be used in banners and practically any page element when combined with the Colorful Categories component. Another advantage of using colors right from the category settings is that you enable community managers to change colors used in a theme themselves, rather then needing to reach out to the theme designer just for that.

Right now when you don’t want to use the core badges with colors, but still use category colors in other theme elements, the only way to change the category color is to enable a different badge style, change the color, then re-enable none as badge-style.

I saw @codinghorror mentioned this concern in another topic about it:

But as said, it can have many effects in a theme. Also, there’s a hint already, stating:

Screenshot from 2022-02-21 09-35-51

So why not keep the setting available and rather give a hint like:

:warning: You might not see colors because you have a category style of none.

2 Likes

Subject says it all.

…except that the colors one chooses are used in the Categories page, even when category-style is set to none. So I have keep changing the categories-style (box, bullet, bar), set color on new category, then set back to none :slight_smile:

1 Like

Do you still want to be able to have those colors on the categories page, or would you prefer them to not appear at all?

I’d lean towards removing them to more broadly honor the “none” personally!

1 Like

I’d not really thought about it. I suppose if I had a real designer on staff, they’d tell me what I should think about that. ¯\_(ツ)_/¯

1 Like

I think I agree with Matthew and its OP here, I’m thinking of using the category color as background for an event in the upcoming calendar, but that might just be bad practice…

I would strongly prefer to keep the colors. The thing that is set to “none” is category style, which is described as “Visual style for category badges.” So “none” just means “no badges” — I don’t think it implies “no color”.

I mentioned that the badges are only place the colors are used in the default theming, but I think I’m actually wrong on that — the Categories page uses them too (as a bar along the left side of the category). (Am I crazy?)

I guess for consistency, maybe this setting should be renamed to something like category label style? [1]


  1. Not `category badge style, since “badges” are a different thing, and already ↩︎

2 Likes

I suppose there’s not much harm to be done if we add the picker back to the “none” style and update the message to say something like “with the category badge style set to none, category colors will only be visible if called for in a theme”

5 Likes

Why not simply use a different category style and add a component to remove the box styling? Should be trivial, only a few css rules ?

I mean, i guess? But why do a weird workaround like that, in which one recreates an existing setting through (potentially fragile and certainly unsupported) CSS rules, just in order to avoid that setting’s unexpected and surprising second-order effect on an unrelated configuration setting?

I don’t see this as unsupported, we can make the component official, it seems to be needed only for theme purposes anyway?

Even then, kind of esoteric? Why would someone even know to look for a theme component to do that?

Why not just let the option to configure color not be hidden when a different setting happens to be in a configuration that doesn’t use color even though other things do?

The tricky thing is that long term we probably only want to carry support for the bullet style in core, it is the only design that is coherent with sidebar.

We may want to retire this setting altogether

Hmmm, ok — that’s useful context. But if anything, it suggests that removing this makes even more sense given that there wouldn’t even be a “none” to worry about. Just let category color be a setting for all the places it is used, and don’t worry if one place that it might not be used is selected?

For what it’s worth, I’m actually using “none” with Category Icons, which I think would also work decently with the sidebar.

Perhaps a simple fix on our part is making that component compatible with bullet category style? Hide bullet when icon is defined

3 Likes