A neumorphism generator example uses one six-digit base color to create paired light and dark CSS box shadows on a raised element whose background matches its surrounding surface.

The defining constraint is that the component and its surroundings share a base color. The generator derives a darker shadow and lighter highlight by moving RGB channels toward black and white, applies equal opposite offsets, and uses the same background, radius, and shadow values in its preview and copied CSS.

The following example develops that rule into a raised card, then shows how to apply it without confusing a decorative shadow with an accessible component state.

neumorphism generator example
Neumorphism Generator Example: Build a Raised CSS Card

A complete neumorphism generator example

Use a card inside a panel with the same base color on both surfaces. For this example, choose #808080 as the base, then configure the paired shadows and corner radius as follows.

Control Example setting Effect
Base color #808080 Sets the component background and the matching parent surface.
Shadow distance 8px Offsets both shadows equally on the horizontal and vertical axes.
Blur radius 16px Softens the edges of both shadows.
Contrast 25% Moves the derived shadow colors away from the base color; it does not set opacity.
Corner radius 12px Rounds the corners of the raised component.

The color derivation is deterministic. For an eight-bit channel C and contrast p, the darker value is round(C × (1 − p)), while the lighter value is round(C + (255 − C) × p). With C = 128 and p = 25%, the darker channel becomes round(128 × 0.75) = 96, or #60, and the lighter channel becomes round(128 + 127 × 0.25) = 160, or #A0. All three source channels have the same value, so the complete shadow colors are #606060 and #A0A0A0.

.neumorphic-card { background: #808080; border-radius: 12px; box-shadow: 8px 8px 16px #606060, -8px -8px 16px #A0A0A0; }

The dark shadow moves down and right, while the light highlight moves up and left. Blur softens both edges, and the equal background color allows the two shadows to imply depth without a visible border. Increasing the contrast percentage creates stronger separation, so inspect the preview rather than assuming that a larger value always looks better.

The generated rule does not add typography, padding, layout, transitions, hover movement, or component states. Those decisions belong to the host design system, which prevents a decorative surface rule from becoming an incomplete production component.

Build the raised card

  1. Open the CSS Neumorphism Generator and choose the base color. Enter the complete six-digit value #808080. An incomplete color is invalid, and bounded inputs prevent negative lengths, non-finite numbers, and extreme settings from entering the CSS declaration.
  2. Identify the surface that will surround the card. Plan to use #808080 on both the component and its parent panel. The generator creates the component background, but the surrounding surface must resolve to the same color for the soft raised effect to appear coherent.
  3. Adjust the paired shadow settings. Set distance to 8px, blur to 16px, and contrast to 25%. Distance controls both axes, blur softens the edges, and contrast changes the derived colors rather than their opacity. Empty numeric fields are errors, not silent zeroes, so complete every required value before copying the rule.
  4. Set the radius and inspect the raised preview. Use a 12px corner radius, then check that the card looks raised rather than cut out, outlined, or detached. The preview reflects the exact background, radius, and box-shadow values used in the generated CSS.
  5. Copy the CSS and apply it to a test component. Add the generated declarations to the card and give its parent the same background color. If the project already has a design token, use that token instead when it resolves to the same color.
  6. Add semantic states and accessibility checks before shipping. Use an appropriate semantic element, provide an explicit keyboard focus indicator, and create separate rules for pressed, disabled, loading, and error conditions. Then inspect the component in light and dark themes, at zoom, in forced-colors mode, and on representative mobile devices.

Match the component to its parent

Neumorphism depends on a close visual relationship between an element and the surface behind it. When the card and parent share the base color, the paired shadows can suggest a continuous soft surface. If the parent has a different background, the same card may look like an unrelated gray box rather than a raised part of the interface.

Condition Likely result Implementation response
Component and parent use the same base color The shadows can imply a continuous raised surface. Use a shared color token for both backgrounds.
The parent uses a different background The card can appear detached or boxed in. Match the surface color or replace the copied background with an equivalent token.
Forced-colors or high-contrast mode discards decorative shadows The depth cue may disappear. Preserve readable text, semantic controls, boundaries, and non-shadow state indicators.

Copying the generated background to the intended parent is therefore part of applying the example, not an optional visual refinement. For the underlying CSS syntax, MDN’s box-shadow property reference documents the offset, blur, and color components, while W3C CSS Backgrounds and Borders Level 3 provides the formal property definition.

Add the states the raised rule omits

The generator produces a raised state only. A pressed or inset appearance, a focus ring, a disabled treatment, and an error treatment each require separate, intentional rules. Shadow direction alone should never be the only indication that a control is selected, pressed, unavailable, or invalid.

  • Use semantic HTML. Prefer a native <button>, link, input, or other appropriate element instead of a generic container with a click handler.
  • Provide visible keyboard focus. Add an explicit :focus-visible outline and offset. Define a focus-color token that remains noticeable against the panel, text, and neighboring shadow colors.
  • Differentiate pressed and selected states. Use a border, icon, label, or other strong state indicator in addition to a change in shadow direction.
  • Keep status visible. Give disabled, loading, and error states distinct semantic and visual treatment so decorative depth does not obscure them.

A starting focus pattern is shown below, after defining and testing the focus token:

.neumorphic-card:focus-visible { outline: 3px solid var(--focus-color); outline-offset: 3px; }

Test text and icons against the actual base color instead of assuming that the style is accessible. Low-contrast boundaries can be difficult to perceive, and a raised button may be hard to distinguish from a pressed inset button for users with low vision. Consider a border or stronger state cue, and ensure the interface remains understandable when shadows are removed.

Check rendering and performance in the real interface

Multiple large, blurred shadows can increase paint cost, particularly in scrolling lists or on animated surfaces. Apply the effect to a small number of stable elements, avoid continuously animating the blur value, and measure representative mobile devices rather than relying only on a desktop preview.

The generated declaration does not include a transition. If a component needs to change elevation, prefer a short transform or a tokenized shadow transition and respect reduced-motion preferences. Decorative depth should never create layout shift, hide loading or error feedback, or make the interface slower merely to preserve the soft-surface appearance.

Browser rendering is one more reason to test the copied rule in its final component. Inspect the card in both themes, zoomed views, forced-colors mode, and the scrolling contexts where it will actually appear. The generator produces deterministic CSS values, but it cannot certify visual hierarchy, browser-specific rendering, or performance in a real product.

Move the generated rule into a reusable workflow

All generator processing stays in the current browser tab. No value is uploaded or saved, no account is required, and no package needs to be installed. The companion explanation of whether a CSS Neumorphism Generator Is Safe to Use Online further explains the local-processing model.

Treat the copied rule as the beginning of an implementation rather than the end. Place it in a test component, match the parent surface, add semantic HTML and focus behavior, and inspect the result across themes, zoom levels, forced-colors mode, and representative devices. If the values need adjustment, update centralized design tokens instead of scattering one-off shadow declarations throughout the project.

The tool validates its CSS-oriented ranges and calculates repeatable shadow colors, but final decisions still require human review. Check text and icon readability, distinguish every interactive state, confirm that the parent surface matches, and measure performance before adopting the neumorphic treatment.

For a deeper look, see CSS Speech Bubble Generator for Beginners: Build One.