You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever one hovers on a post there's a visible border color that is specific to the category of the post. For example, the category for this post is android, so wherever there's a link to this post, there's a green hover color.
This color is achieved by templating the classes for the link with these classes: hover:border-{{ category }} and an !important field for dark:hover:!border-{{ category }} (notice !) where {{ category }} denotes the category of the current post that Jekyll is rendering:
There are two classes in a single element: dark:hover:border-slate-200 dark:hover:!border-{{ category }}, and the second one is marked important with ! to force apply category color and fallback to default color if it isn't present.
This is done because if there is no specific color assigned in the tailwind.config.js file, It falls back to the default black color in light mode and white border in dark mode.
There needs to be such hard-coding because tailwind can't automatically include dynamic CSS classes, at least up to the point I have tested it with Jekyll.
There is a need to find a better solution than manually having to hardcode the safelist every time...
The text was updated successfully, but these errors were encountered:
Whenever one hovers on a post there's a visible border color that is specific to the category of the post. For example, the category for this post is android, so wherever there's a link to this post, there's a green hover color.
This color is achieved by templating the classes for the link with these classes:
hover:border-{{ category }}
and an!important
field fordark:hover:!border-{{ category }}
(notice!
) where{{ category }}
denotes the category of the current post that Jekyll is rendering:theme-files/_includes/postbox.html
Line 6 in abf9722
The possible combinations for the categories are defined in the
tailwind.config.js
file's safelist section:theme-files/tailwind.config.js
Lines 6 to 22 in a6b973e
And the colors are there in the section:
theme-files/tailwind.config.js
Lines 23 to 37 in a6b973e
There are two classes in a single element:
dark:hover:border-slate-200 dark:hover:!border-{{ category }}
, and the second one is marked important with!
to force apply category color and fallback to default color if it isn't present.This is done because if there is no specific color assigned in the
tailwind.config.js
file, It falls back to the default black color in light mode and white border in dark mode.There needs to be such hard-coding because tailwind can't automatically include dynamic CSS classes, at least up to the point I have tested it with Jekyll.
There is a need to find a better solution than manually having to hardcode the safelist every time...
The text was updated successfully, but these errors were encountered: