How the Neumorphism (Soft UI) Effect Is Built
Neumorphism gives an element the same background colour as its parent and layers two box-shadows on it — a lighter highlight offset toward the simulated light source and a darker shadow offset the opposite way — so the element looks softly extruded from the surface. This generator’s engine (neumorphismEngine.ts) converts the base colour to HSL and shifts its lightness up by an intensity delta for the highlight and down by the same delta for the shadow, then computes the offsets from a single distance value with a blur that defaults to roughly twice that distance.
- Two box-shadows on one element: light highlight + dark shadow, opposite offsets
- Shadow colours = base HSL lightness shifted up (light) and down (dark) by intensity
- Blur defaults to ~2× the offset distance for the soft extruded look
- The element and its parent must share the base background colour
- Deterministic and pure — same inputs always yield the same CSS
