jjranalli / nightwind

An automatic, customisable, overridable Tailwind dark mode plugin
https://nightwindcss.com
MIT License
713 stars 45 forks source link

individual color mapping not working #39

Closed MobtakerFanavariPayvar closed 2 years ago

MobtakerFanavariPayvar commented 2 years ago

I cannot work with individual colors nor custom colors which I have already defined in extend section of my configuration, for example:

nightwind: {
      colors: {
        '#1E208D': '#ff0000'
      }

does not convert #1E208D to the color #fff0000 in the dark mode. I don't know if I'm misunderstanding something or doing something wrong

jjranalli commented 2 years ago

Hi, color mapping works when you link it to the relative tailwind color code (such as 'primary-600'). You can find more details on how to use mappings in the docs

In your case, assuming you mapped #1E208D to 'primary-600' in tailwind config, it would look like this

// tailwind.config.js

theme: {
      // define custom color
      extend: {
        colors: {
          primary: {
            600: "#1E208D",
          },
        },
      },

      // define color mapping
      nightwind: {
        colors: {
          primary: {
            600: "#ff0000",
          },
        },
      },
},