Skip to content

Commit 064e610

Browse files
committed
refactor: port content shadow to Open Props shadow-4 pattern
Replace PicoCSS-style blur-only shadow (7 layers, rem units, 0 spread) with Open Props shadow-4 structure (negative -2px spread, px units, tighter 1-16px blur range). Reduces visible striation by shrinking each layer's footprint so they overlap gradually instead of stacking as concentric rings.
1 parent 3b5fadf commit 064e610

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

src/_shadow.scss

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,36 @@
1717
@use 'sass:string';
1818
@use 'config' as *;
1919

20-
// Helper: build a shadow layer with spread value and light-dark() color
21-
@function _shadow-layer-spread($blur, $spread, $light-color, $light-alpha, $dark-color, $dark-alpha) {
20+
// Helper: build a shadow layer with light-dark() color
21+
@function _shadow-layer($blur, $spread, $light-color, $light-alpha, $dark-color, $dark-alpha) {
2222
@return string.unquote(
2323
'0 0 #{$blur} #{$spread} light-dark(oklch(#{$light-color} / #{$light-alpha}), oklch(#{$dark-color} / #{$dark-alpha}))'
2424
);
2525
}
2626

2727
// Build a 7-layer progressive content shadow.
28-
// Each layer uses light-dark() so opacity adapts to the color scheme.
29-
// Modeled after PicoCSS/veneer card shadow with stronger presence.
28+
// Ported from Open Props --shadow-4: negative spread (-2px) on blur layers
29+
// so visible footprints overlap gradually instead of stacking as concentric
30+
// rings. light-dark() on each layer's color swaps shadow (dark oklch) for
31+
// glow (light oklch) automatically.
3032
@function _content-shadow($light-color, $dark-color) {
3133
@return
32-
_shadow-layer-spread(0.15rem, 0, $light-color, 0.02, $dark-color, 0.015),
33-
_shadow-layer-spread(0.3rem, 0, $light-color, 0.03, $dark-color, 0.02),
34-
_shadow-layer-spread(0.75rem, 0, $light-color, 0.04, $dark-color, 0.025),
35-
_shadow-layer-spread(1.35rem, 0, $light-color, 0.04, $dark-color, 0.03),
36-
_shadow-layer-spread(2.5rem, 0, $light-color, 0.05, $dark-color, 0.035),
37-
_shadow-layer-spread(6rem, 0, $light-color, 0.06, $dark-color, 0.04),
38-
_shadow-layer-spread(0rem, 0.0625rem, $light-color, 0.015, $dark-color, 0.01);
34+
_shadow-layer(5px, 0, $light-color, 0.03, $dark-color, 0.015),
35+
_shadow-layer(1px, -2px, $light-color, 0.04, $dark-color, 0.02),
36+
_shadow-layer(2px, -2px, $light-color, 0.04, $dark-color, 0.025),
37+
_shadow-layer(5px, -2px, $light-color, 0.05, $dark-color, 0.03),
38+
_shadow-layer(9px, -2px, $light-color, 0.06, $dark-color, 0.035),
39+
_shadow-layer(16px, -2px, $light-color, 0.07, $dark-color, 0.04),
40+
_shadow-layer(0px, 0.0625rem, $light-color, 0.015, $dark-color, 0.01);
3941
}
4042

4143
@layer nimble.base {
4244

4345
:root {
4446
// Soft elevation shadow on the padded content column.
4547
// Uses surface hue for tonal consistency; adapts to light/dark mode.
48+
// Each layer uses light-dark() on the color: dark oklch for shadow,
49+
// light oklch for glow. Switches automatically with color-scheme.
4650
// Override with --nc-content-shadow: none to disable.
4751
#{$prefix}content-shadow: #{_content-shadow(
4852
$content-shadow-color-light, $content-shadow-color-dark

0 commit comments

Comments
 (0)