Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested custom colors not automatically switching to dark mode #27

Open
epleaner opened this issue Jul 9, 2021 · 1 comment
Open

Nested custom colors not automatically switching to dark mode #27

epleaner opened this issue Jul 9, 2021 · 1 comment

Comments

@epleaner
Copy link

epleaner commented Jul 9, 2021

Expected

Using these custom colors:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: {
          50: "#caf0f8", 
          300: "#90e0ef", 
          600: "#0077b6", 
          900: "#03045e",
        },
        nested: {
          primary: {
          50: "#caf0f8", 
          300: "#90e0ef", 
          600: "#0077b6", 
          900: "#03045e",
        },
        },
      },
  },
}

When something like this is rendered in dark mode:

<div className="w-64 h-64 bg-nested-primary-50" />

It renders with bg-nested-primary-900, as it would if it were:

<div className="w-64 h-64 bg-primary-50" />

Actual

In dark more,

<div className="w-64 h-64 bg-nested-primary-50" />

does not change colors to its dark variant.

Current workaround:

Key nested colors as hyphenated keys:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        primary: {
          50: "#caf0f8", 
          300: "#90e0ef", 
          600: "#0077b6", 
          900: "#03045e",
        },
        "nested-primary": {
          50: "#caf0f8", 
          300: "#90e0ef", 
          600: "#0077b6", 
          900: "#03045e",
        },
        },
      },
  },
}
@jjranalli
Copy link
Owner

Thanks for pointing this out and proposing a workaround. Planning to fix this in a future version of the library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants