docs(skill): say what the reset leaves alone, and how a token takes alpha - #671
Merged
Merged
Conversation
…lpha Two things readers worked out the hard way, both from the same project. `@devup-ui/reset-css` is a normalize, not a preflight, and for form controls it does exactly two things: `margin: 0`, and `-webkit-appearance: button` — which *preserves* the native control appearance rather than removing it. Button `padding`, `border` and `appearance` are deliberately untouched, so a button still carries the UA defaults. That is invisible until a button is sized in design units. Because `box-sizing: border-box` is global, an explicit `8px` width cannot shrink below the `6 + 6 + 2 + 2 = 16px` that Chrome's default `padding: 1px 6px` and `border: 2px outset` already occupy, and an 8x8 button from a design renders 16x8. Nothing is broken and no token is wrong; the reset never claimed those properties. The section now says so and shows the call-site fix. The other is alpha. A token *is* a CSS custom property, which the `$token Scope` section already says two paragraphs above — so a token at partial opacity is `color-mix()` over `var(--token)`, with no alpha token to define and no hardcoded copy of the colour to keep in sync. Not knowing that, a screen hardcoded `#F7F3EC66` beside a `$bg` that was already the same colour. That is not merely redundant: `$bg` follows the active theme and the literal does not, so the surface stays light in dark mode. `opacity` is not a substitute either, since it fades the element together with everything inside it while `color-mix()` fades only the paint.
Contributor
Changepacks |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two things readers worked out the hard way, both from the same project.
SKILL.mdonly — no package touched, so no changepack.The reset leaves buttons alone, and nothing said so
@devup-ui/reset-cssis a normalize, not a preflight. For form controls it does exactly two things:The second one preserves the native control appearance rather than removing it.
padding,borderandappearanceare deliberately untouched.That stays invisible until a button is sized in design units. Because
box-sizing: border-boxis global, an explicit8pxwidth cannot shrink below the6 + 6 + 2 + 2 = 16pxthat Chrome's defaultpadding: 1px 6pxandborder: 2px outsetalready occupy — so an 8×8 button from a design renders 16×8. The arithmetic predicts the reported number exactly.Nothing is broken and no token is wrong; the reset never claimed those properties. The section now says so and shows the call-site fix.
A token at 40% has an answer already
The
$token Scopesection two paragraphs above already says a token is a CSS custom property —var(--token)is how you use one outside a JSX prop. So a token at partial opacity iscolor-mix()over it, with no alpha token to define and no copy of the colour to keep in sync:Not knowing that, a screen hardcoded
#F7F3EC66beside a$bgthat was already the same colour. That is not merely redundant —$bgfollows the active theme and the literal does not, so the surface stays light in dark mode.opacityis not a substitute either: it fades the element together with everything inside it, whilecolor-mix()fades only the paint.Note for
devup-mcpdevup-mcp vendors this document into its binary, so
devup_skills installwrites it on machines with no network. Once this merges,node scripts/refresh-skills.mjsover there picks it up — I will follow with that PR.