Inline category badge styles - Change to Stylesheet

AI 生成的摘要

The discussion revolves around inline category badge styles and the possibility of moving them to a stylesheet. strager initially requested this change to facilitate easier customization. codinghorror pointed out that the colors are set via category preferences and can be changed by editing the category. However, strager and others found this method limiting, especially when trying to customize the “all categories” badge.

cpradio provided a workaround using CSS, and Bill_S confirmed it worked. Meanwhile, Francois_Eric_King and Thomas_Emmpunkt encountered issues changing the badge color in the edit category popup page. mikechristopher offered a solution, suggesting to click on a color in the background color section, which Thomas_Emmpunkt found worked, albeit with a slight delay.

@Bill_S pointed this out to me this morning…

There shouldn’t be any inline styles. Otherwise, we cannot style those particular elements. Can we get them moved to the style sheet? Please?

1 个赞

This is not a bug, those colors are set via the category preferences as in “this is the color that represents this category”. To change them click edit on the category and specify a new color for the category badge…

I agree its not a bug, but it does make customizing category badges a bit more tricky.

Longer term I am happy to clean up the extensibility method here, you can probably just override the function in a plugin / site extension.

We found a way to override it using !important, but it’s a bit of a hack…

You also cant can’t the color directly on /category (for “all categories”) since there is no Edit option there.

Actually you can, you simply have to use

.category-dropdown-menu div.cat:first { background-color: #FF0000; } /* may still need !important */
1 个赞

Thanks guys, we got it.

To change them click edit on the category and specify a new color for the category badge…but iam not able to change it.

badge color in edit category popup page is not clickable or editable. Any clue?

Can you provide a screenshot?

1 个赞

if you click on a colour in the background color section below it - it should change?

3 个赞

Yes, indeed! It changes. Even if it takes a few seconds until the “Badge color” field changes it’s color so that I as the user do notice, that I hit the right button.

Maybe “Background color” is a false leading wording. But thanks for the (more than logic) hint!

2 个赞