--- visible: true type: tip title: Adding themed icons in Tailwind subtitle: Using Tailind's fill-current to color svg icons in dark mode. date: '2021-11-13' author: Nate Butler summary: >- --- While setting up `@nuxtjs/color-mode` to work with `Tailwind.css`, I realized that getting SVG icons to respect the color mode was weird without writing extra css outside Tailwind. Tailwind doesn't have `fill` or `stroke` colors like `text-green-500` or `bg-white`, which means that you can't do: ``` ``` That is the first thing I thought of when I tried to get this working. It is possible to get this working by extending your `tailwind.config.js` (more [here](https://tailwindcss.com/docs/stroke#customizing)), but there is an easier way that allows you to style all icons at once: `stroke-current` (and `fill-current`). ## Using `stroke-current` It wasn't obvious what this would do when it popped up in my IntelliSense when I try to complete `stroke-` the first time. `stroke-current` takes whatever text color is on it's parent and sets it's `stroke` to that color. This also gets re-applied when the color mode changes, which gives us a really simple way to swap svg colors as the theme changes. In the end, it looks like this: ```