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

[Feature]: Tailwind colors #1148

Open
zmzlois opened this issue Jun 5, 2024 · 3 comments
Open

[Feature]: Tailwind colors #1148

zmzlois opened this issue Jun 5, 2024 · 3 comments
Labels
🐞 bug Something isn't working

Comments

@zmzlois
Copy link

zmzlois commented Jun 5, 2024

Version

System:
    OS: macOS 14.2.1
    CPU: (12) arm64 Apple M2 Pro
    Memory: 82.77 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 125.0.6422.142
    Safari: 17.2.1
  npmPackages:
    rspress: ^1.18.1 => 1.18.1

Details

As title stated

  1. tailwind colors don't work until they are explicitly configured in tailwind.config.ts, thought this might be a bug?
Screenshot 2024-06-05 at 03 09 29
  1. any documentation on incorporating rspress exposed brand assets to be used with tailwind variables?
Screenshot 2024-06-05 at 03 07 28 On tailwind docs (I tried it a couple times hex colors doesn't work at all) it didn't specify how should hex colors be used https://tailwindcss.com/docs/customizing-colors#using-css-variables

Reproduce link

https://github.com/zmzlois/docs/tree/homepage-change

Reproduce Steps

  1. Clone the repo
  2. Delete color configuration in tailwind.config.ts
  3. npm i && npm run dev
@zmzlois zmzlois added the 🐞 bug Something isn't working label Jun 5, 2024
@Timeless0911
Copy link
Collaborator

I can't reproduce this issue. The issue of tailwind css has nothing to do with Rspress. You can check related issue of tailwind maybe.

@zmzlois zmzlois changed the title [Bug]: Tailwind colors [Feature]: Tailwind colors Jun 5, 2024
@zmzlois
Copy link
Author

zmzlois commented Jun 5, 2024

I can't reproduce this issue. The issue of tailwind css has nothing to do with Rspress. You can check related issue of tailwind maybe.

Is it possible to give variable values with rgba colors or hsl colors rather than hex?

atm in tailwind we can do inlinetext-[var(--rp-c-brand)] and this would work,

but if I am extending the colors in tailwind config say

  extend: {
      colors: {

        background: {
          DEFAULT: "hex(var(--rp-c-bg)/<alpha-value>)", // this won't work
		  light: "hsl(var(--rp-c-bg)/<alpha-value>)", // this would work if `--rp-c-bg` is hsl value
          dark: "#1a1a1a", // this would
        },
        "soft-background": {
          DEFAULT: "#f9f9f9",

        }
      }
    },

@Timeless0911
Copy link
Collaborator

The default theme color variants can be customized via globalStyles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants