How to color-code tags? #2541
-
any pointers on how to color-code tags? e.g., I'd like "general" to be green, "other" to be blue, etc. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can color-code tags or categories with some simple CSS. First create a Custom CSS file by creating a file named Then for each tag URL (e.g. .article-tags a[href='/tag/academic/'] {
background: deeppink;
color: white;
} The tags will then be color-coded on your site: If you wish to create different color-codings for the dark mode, you can add a second style for each tag, this time prefixing with
If there's a lot of demand for this feature (add a thumbs up to the first post in this thread), we can consider integrating automated tag coloring. |
Beta Was this translation helpful? Give feedback.
You can color-code tags or categories with some simple CSS.
First create a Custom CSS file by creating a file named
custom.scss
in yourassets/scss/
folder (creating those folders if necessary). Docs: https://wowchemy.com/docs/hugo-tutorials/extending-wowchemy/#customize-style-cssThen for each tag URL (e.g.
/tag/academic/
) choose a background and text color for the tag:The tags will then be color-coded on your site:
If you wish to create different color-codings for the dark mode, you can add a second style for each tag, this time prefixing with
.dark
: