Last updated
Neumorphism Accessibility Warning
/* Neumorphism has known accessibility issues:
- Low contrast between elements and background
- Hard to distinguish interactive from non-interactive elements
- Fails WCAG contrast requirements in many configurations
Contrast check for typical neumorphic design:
Element background: #e0e5ec
Page background: #e0e5ec
Contrast ratio: 1:1 (identical — no contrast at all)
Recommendations:
1. Add text with sufficient contrast (dark text on light bg)
2. Use neumorphism for decorative elements, not critical UI
3. Ensure interactive elements have clear hover/focus states
4. Consider adding a subtle border for better definition
5. Test with users who have low vision
*/
/* Accessible neumorphic button — add color accent */
.neumorphic-btn-accessible {
background: #e0e5ec;
border-left: 3px solid #2563eb; /* color accent for identification */
box-shadow:
5px 5px 10px #a3b1c6,
-5px -5px 10px #ffffff;
}
Shadow Calculation Formula
- Light shadow: lighten the background color by 10-15%
- Dark shadow: darken the background color by 10-15%
- Shadow distance: 4-8px for small elements, 6-12px for larger ones
- Blur radius: 2× the shadow distance for soft shadows
- Background color must exactly match the element's background
The CSS Neumorphism Generator on TechConverter.me automatically calculates the correct light and dark shadow colors from your background color. Adjust the shadow distance, blur, and intensity, then copy the generated CSS with both raised and pressed states included.
Examples
Example 1: Basic Neumorphic Card
/* Background color must match the element color */
:root {
--bg: #e0e5ec;
--shadow-light: #ffffff;
--shadow-dark: #a3b1c6;
}
/* Raised (extruded) element */
.neumorphic-card {
background: var(--bg);
border-radius: 16px;
padding: 2rem;
box-shadow:
6px 6px 12px var(--shadow-dark),
-6px -6px 12px var(--shadow-light);
}
/* Pressed (inset) element */
.neumorphic-pressed {
background: var(--bg);
border-radius: 16px;
padding: 2rem;
box-shadow:
inset 6px 6px 12px var(--shadow-dark),
inset -6px -6px 12px var(--shadow-light);
}
Example 2: Neumorphic Button with States
:root {
--bg: #e0e5ec;
}
.neumorphic-btn {
background: #e0e5ec;
border: none;
border-radius: 10px;
padding: 0.75rem 1.5rem;
font-size: 0.875rem;
font-weight: 600;
color: #4a5568;
cursor: pointer;
box-shadow:
5px 5px 10px #a3b1c6,
-5px -5px 10px #ffffff;
transition: box-shadow 0.15s ease, transform 0.1s ease;
}
/* Hover state — slightly more pronounced */
.neumorphic-btn:hover {
box-shadow:
7px 7px 14px #a3b1c6,
-7px -7px 14px #ffffff;
}
/* Active/pressed state — inset shadow */
.neumorphic-btn:active {
box-shadow:
inset 4px 4px 8px #a3b1c6,
inset -4px -4px 8px #ffffff;
transform: scale(0.98);
}
/* Focus state — accessible ring */
.neumorphic-btn:focus-visible {
outline: 2px solid #2563eb;
outline-offset: 3px;
}
/* Disabled state */
.neumorphic-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
box-shadow:
3px 3px 6px #a3b1c6,
-3px -3px 6px #ffffff;
}
Example 3: Neumorphic Toggle Switch
.neumorphic-toggle {
position: relative;
width: 60px;
height: 30px;
background: #e0e5ec;
border-radius: 15px;
box-shadow:
inset 3px 3px 6px #a3b1c6,
inset -3px -3px 6px #ffffff;
cursor: pointer;
}
.neumorphic-toggle::after {
content: '';
position: absolute;
top: 4px;
left: 4px;
width: 22px;
height: 22px;
border-radius: 50%;
background: #e0e5ec;
box-shadow:
2px 2px 5px #a3b1c6,
-2px -2px 5px #ffffff;
transition: transform 0.3s ease;
}
.neumorphic-toggle.active::after {
transform: translateX(30px);
background: #2563eb;
box-shadow:
2px 2px 5px rgba(37, 99, 235, 0.4),
-2px -2px 5px rgba(255, 255, 255, 0.8);
}