Skip to content

How to color-code tags? #2541

Answered by gcushen
fred-oswald asked this question in Ideas
Discussion options

You must be logged in to vote

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 your assets/scss/ folder (creating those folders if necessary). Docs: https://wowchemy.com/docs/hugo-tutorials/extending-wowchemy/#customize-style-css

Then for each tag URL (e.g. /tag/academic/) choose a background and text color for the tag:

.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 .dark:

.dark .article-tags a[href='/tag/source-themes/']…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gcushen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants