-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
[starlight-tailwind]: CSS warnings when setting a custom white tone using the tailwind plugin #1716
Comments
Ah, interesting. I think this is because we use starlight/packages/tailwind/index.ts Line 68 in 093a32c
The default Tailwind colors shape is something like this: const colors = {
transparent: "transparent",
black: "#000",
white: "#fff",
gray: {
50: "#f8fafc",
100: "#f1f5f9",
200: "#e2e8f0",
// etc.
},
// other colors
} So Usually when setting an alternate gray shade, this is done via Do you think we should support bending Tailwind’s palette naming or would a clear error for this case and not supporting it be acceptable? |
But it works for black changing the pure black to a shade of the given color without any warnings, I think white should do the same, probably by taking the lightest shade of the color |
Not really! Starlight’s colour scheme doesn’t use Tailwind’s If someone really, really wanted to have a different shade for their whites, they could set e.g. This kind of a conceptual distinction: there are palettes that range from dark to light ( |
Interesting! In that case I think this should be an error at Tailwind level. Is this something I should report on Astro's Tailwind integration or on Tailwind directly? I have no idea how CSS tooling works and where each one's responsibility ends. |
I still think this is a Starlight-specific limitation that should have a nice error on our end rather than anything else. While Tailwind has that shape I described as a sensible default, it’s also in the end agnostic about what users decide to do with it. For example, Tailwind uses that colors: {
rainbow: {
red: '#ff0000',
orange: '#ffa500',
yellow: '#ffff00',
// ...
},
}, And then use those as So I don’t think Tailwind would see this as an error on their end, and the Astro integration does very close to nothing, so it’s not there either. Instead I see it as:
If we were imposing a limitation that was unacceptable, we would aim to fix that and make our plugin more flexible. But in this case, I think expecting |
What version of
@astrojs/starlight-tailwind
are you using?2.0.1
What version of
astro
are you using?4.5.16
What package manager are you using?
pnpm
What operating system are you using?
Linux
What browser are you using?
Chrome
Describe the Bug
When using the
@astrojs/starlight-tailwind
and configuring a custom white color, the build emits multiple warnings regarding CSS.The config:
The warnings (truncated for brevity; it has about 20 of them):
This problem only happens for the
colors -> white
field. I tested withcolors -> accent
andcolors -> black
; those fields don't have the same problem.Passing other colors in that configuration also shows the same warning; it is not specific to Tailwind's Stone color.
The same configuration without the
@astrojs/starlight-tailwind
plugin shows no warnings.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qea4d6?file=tailwind.config.mjs
Participation
The text was updated successfully, but these errors were encountered: