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

feat!: support Tailwind v4 #22

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

feat!: support Tailwind v4 #22

wants to merge 12 commits into from

Conversation

unseen-ninja
Copy link
Member

@unseen-ninja unseen-ninja commented Mar 2, 2025

This PR aims to provide a semi-automatic SASS-based build system to generate viable configs for Tailwind v4. (#19)

The current setup generates two distinct files.

  1. shades.css is home to all of Catppuccin's colours and the different tints and shades tailwind expects. Tints and shades are only generated for each of the 14 accent colours.
  2. tailwind.config.css then is the actual config tailwind uses. This builds on top of shades.css therefore it needs to be imported in your CSS structure!

The Tailwind config provides default colours for light and dark mode (set to be latte and mocha respectively) as well as flavour classes and custom variants for each of the four flavours.

In short a demo config file would look like this:

@import "tailwindcss";


/* from shades.css */
:root {
  --catppuccin-latte-mauve: #8839ef;
  --catppuccin-latte-base: #eff1f5;
  --catppuccin-frappe-mauve: #ca9ee6;
  --catppuccin-frappe-base: #303446;
  --catppuccin-macchiato-mauve: #c6a0f6;
  --catppuccin-macchiato-base: #24273a;
  --catppuccin-mocha-mauve: #cba6f7;
  --catppuccin-mocha-base: #1e1e2e;
}



/* from tailwind.config.css */
@theme inline {
  --color-ctp-mauve: var(--catppuccin-mauve);
  --color-ctp-base: var(--catppuccin-base);
}


@layer base {
  :root {
    --catppuccin-mauve: var(--catppuccin-latte-mauve);
    --catppuccin-base: var(--catppuccin-latte-base);
    @variant dark {
      --catppuccin-mauve: var(--catppuccin-mocha-mauve);
      --catppuccin-base: var(--catppuccin-mocha-base);
    }
  }
  .latte {
    --catppuccin-mauve: var(--catppuccin-latte-mauve);
    --catppuccin-base: var(--catppuccin-latte-base);
  }
  .frappe {
    --catppuccin-mauve: var(--catppuccin-frappe-mauve);
    --catppuccin-base: var(--catppuccin-frappe-base);
  }
  .macchiato {
    --catppuccin-mauve: var(--catppuccin-macchiato-mauve);
    --catppuccin-base: var(--catppuccin-macchiato-base);
  }
  .mocha {
    --catppuccin-mauve: var(--catppuccin-mocha-mauve);
    --catppuccin-base: var(--catppuccin-mocha-base);
  }
}

Due to tailwinds extensive rewrite in version 4 a lot of things previously used in this repo aren't needed anymore.
@unseen-ninja
Copy link
Member Author

This is how it could look in the end: https://play.tailwindcss.com/eYXckDj09D

@sgoudham sgoudham linked an issue Mar 2, 2025 that may be closed by this pull request
@sgoudham sgoudham changed the title Tailwind V4 feat!: support Tailwind v4 Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant