Skip to content

Commit 0ef0d46

Browse files
committed
refactor: consolidate text-1/text-2 into single --nc-text variable
1 parent 7dbc266 commit 0ef0d46

8 files changed

Lines changed: 12 additions & 16 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ For build-time customization, override any SCSS config variable:
156156
nimble.css combines [Open Props](https://open-props.style/)'s design token philosophy with [PicoCSS](https://picocss.com/)'s classless aesthetics. Key concepts borrowed from Open Props:
157157

158158
- **Surface hierarchy** (`surface-1` through `surface-4`) — layered backgrounds for page, card, input, and overlay contexts. Defined in `_colors.scss` from OKLCH parameters rather than imported at runtime.
159-
- **Text hierarchy** (`text-1`, `text-2`) — primary and muted text colors, same naming convention as Open Props.
159+
- **Text color** (`text`) — single text color variable; muted text derived inline via `color-mix()`.
160160
- **OKLCH color space** — perceptually uniform color system. Change `$primary-hue` and the entire palette regenerates consistently.
161161
- **Curated scale values**`$spacing: 1rem` (~Open Props `size-3`) and `$radius: 0.25rem` (~Open Props `radius-2`) are sourced from Open Props' scales.
162162
- **Minimal DevTools pollution**~20 semantic custom properties on `:root` plus scoped `--_` internals per component, rather than dumping hundreds of variables globally.

demo/extended.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ <h2>Typography</h2>
287287
</main>
288288

289289
<footer>
290-
<p><small>nimble.css — Extended Demo. <a href="https://github.com/nicholasgasior/nimble.css">Source on GitHub</a>.</small></p>
290+
<p><small>nimble.css — Extended Demo. <a href="https://github.com/leftium/nimble.css">Source on GitHub</a>.</small></p>
291291
</footer>
292292

293293
<script>

specs/nimble-css.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ Compared to the original draft's ~25, we cut:
235235
- `border-muted` -- derived from `--nc-border` at lower opacity where needed
236236
- `mark` -- hardcoded yellow, not worth a variable
237237
- `transition` -- hardcoded `0.2s ease-in-out`
238-
- `text-heading` -- headings differentiate via size, not color
239238
- `text-1` / `text-2` -- replaced by single `--nc-text`; muted text uses `color-mix()` inline
239+
- `text-heading` -- headings differentiate via size, not color
240240
- `wide-width` -- hardcoded in `.wide` utility
241241
- `line-height`, `font-size` -- hardcoded sensible defaults (1.5, 100%)
242242

src/_colors.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,10 @@
4545
}
4646

4747
// ----- Text -----
48-
#{$prefix}text-1: #{_light-dark(
48+
#{$prefix}text: #{_light-dark(
4949
_oklch(0.280, 0.005, $surface-hue),
5050
_oklch(0.860, 0.005, $surface-hue)
5151
)};
52-
#{$prefix}text-2: #{_light-dark(
53-
_oklch(0.580, 0.005, $surface-hue),
54-
_oklch(0.650, 0.005, $surface-hue)
55-
)};
5652

5753
// ----- Border -----
5854
#{$prefix}border: #{_light-dark(

src/_document.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
font-family: var(#{$prefix}font-sans);
1313
font-size: 100%; // = 16px in most browsers
1414
line-height: 1.5;
15-
color: var(#{$prefix}text-1);
15+
color: var(#{$prefix}text);
1616
background-color: var(#{$prefix}surface-1);
1717
}
1818

@@ -36,7 +36,7 @@
3636
// Selection styling using primary accent
3737
::selection {
3838
background-color: var(#{$prefix}primary-focus);
39-
color: var(#{$prefix}text-1);
39+
color: var(#{$prefix}text);
4040
}
4141

4242
}

src/_forms.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
background-color: var(--_input-bg);
1919
border: 1px solid var(#{$prefix}border);
2020
border-radius: var(#{$prefix}radius);
21-
color: var(#{$prefix}text-1);
21+
color: var(#{$prefix}text);
2222
font: inherit;
2323
font-size: 1rem; // >=16px prevents iOS Safari auto-zoom on focus
2424
transition: border-color 0.2s, box-shadow 0.2s;
@@ -46,7 +46,7 @@
4646
margin-top: calc(var(#{$prefix}spacing) * -0.75); // pull up under the input
4747
margin-bottom: var(#{$prefix}spacing);
4848
font-size: 0.875em;
49-
color: var(#{$prefix}text-2);
49+
color: color-mix(in oklch, var(#{$prefix}text), transparent 40%);
5050
}
5151

5252
// ----- Validation states (aria-invalid) -----
@@ -283,7 +283,7 @@
283283
// ----- File -----
284284

285285
:where([type="file"]) {
286-
color: var(#{$prefix}text-1);
286+
color: var(#{$prefix}text);
287287
font: inherit;
288288
cursor: pointer;
289289
max-width: 100%; // Prevent native file input from overflowing container (iOS Safari)
@@ -319,7 +319,7 @@
319319
background-color: var(--_input-bg);
320320
border: 1px solid var(#{$prefix}border);
321321
border-radius: var(#{$prefix}radius);
322-
color: var(#{$prefix}text-1);
322+
color: var(#{$prefix}text);
323323
font: inherit;
324324
font-size: 1rem; // >=16px prevents iOS Safari auto-zoom on focus
325325
margin-bottom: var(#{$prefix}spacing);

src/_media.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
:where(figcaption) {
2121
font-size: 0.9em;
22-
color: var(#{$prefix}text-2);
22+
color: color-mix(in oklch, var(#{$prefix}text), transparent 40%);
2323
margin-top: 0.5em;
2424
}
2525

src/_typography.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ $_heading-phone: (
103103
:where(blockquote) cite {
104104
font-style: normal;
105105
font-size: 0.9em;
106-
color: var(#{$prefix}text-2);
106+
color: color-mix(in oklch, var(#{$prefix}text), transparent 40%);
107107
}
108108

109109
// ----- Horizontal Rule -----

0 commit comments

Comments
 (0)