Gradients and Duotone
Color transitions and two-tone overlays that add depth, vibrancy, and visual energy to web interfaces.
Core Principles
1. Color as the Hero
Gradients and duotone make color the primary design element, not just a background choice.
2. Smooth Transitions
Colors blend smoothly to create depth, movement, and visual interest.
3. Purposeful Color Choices
Each gradient combination communicates a specific mood: warm, cool, energetic, calm.
4. Layered Depth
Overlapping gradients and transparent layers create dimensional interfaces without shadows.
5. Brand Differentiation
A signature gradient becomes a recognizable brand asset (think Instagram, Spotify).
Types of Gradients
| Type | CSS Property | Use Case |
|---|---|---|
| Linear | linear-gradient() | Backgrounds, overlays, buttons |
| Radial | radial-gradient() | Spotlight effects, circular elements |
| Conic | conic-gradient() | Charts, color wheels, creative effects |
| Mesh | Multiple overlapping radials | Complex, multi-color backgrounds |
Visual Characteristics
Gradient Palettes
/* Warm sunset */
:root {
--gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
--gradient-sunrise: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
}
/* Cool ocean */
:root {
--gradient-ocean: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
--gradient-ice: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
}
/* Vibrant energy */
:root {
--gradient-neon: linear-gradient(135deg, #f857a6 0%, #ff5858 100%);
--gradient-electric: linear-gradient(135deg, #00c6fb 0%, #005bea 100%);
}
/* Nature */
:root {
--gradient-forest: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
--gradient-earth: linear-gradient(135deg, #c94b4b 0%, #4b134f 100%);
}
/* Dark/Moody */
:root {
--gradient-midnight: linear-gradient(135deg, #232526 0%, #414345 100%);
--gradient-abyss: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}
Duotone Colors
/* Duotone: map an image to two colors */
/* Classic combinations */
:root {
--duo-blue-pink: #0052d4, #f857a6;
--duo-purple-orange: #6a0dad, #ff6b35;
--duo-teal-yellow: #009688, #ffeb3b;
--duo-navy-coral: #1a1a3e, #ff6f61;
}
Implementation Examples
Gradient Hero Section
<section class="gradient-hero">
<div class="gradient-hero__content">
<h1>Color in Motion</h1>
<p>Gradients bring depth and energy to every pixel.</p>
<div class="gradient-hero__ctas">
<a href="#" class="gradient-btn">Get Started</a>
<a href="#" class="gradient-btn gradient-btn--outline">Learn More</a>
</div>
</div>
</section>
.gradient-hero {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #ffffff;
padding: 40px;
text-align: center;
}
.gradient-hero__content h1 {
font-size: clamp(3rem, 8vw, 6rem);
font-weight: 800;
margin: 0 0 20px;
line-height: 1.05;
}
.gradient-hero__content p {
font-size: 1.25rem;
opacity: 0.9;
margin: 0 0 40px;
max-width: 500px;
margin-left: auto;
margin-right: auto;
}
.gradient-hero__ctas {
display: flex;
gap: 16px;
justify-content: center;
}
.gradient-btn {
display: inline-block;
padding: 14px 32px;
background: #ffffff;
color: #667eea;
text-decoration: none;
font-weight: 700;
border-radius: 8px;
transition: transform 0.2s, box-shadow 0.3s;
}
.gradient-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.gradient-btn--outline {
background: transparent;
color: #ffffff;
border: 2px solid rgba(255, 255, 255, 0.5);
}
.gradient-btn--outline:hover {
border-color: #ffffff;
background: rgba(255, 255, 255, 0.1);
}
Gradient Card
<article class="gradient-card">
<div class="gradient-card__accent"></div>
<div class="gradient-card__content">
<span class="gradient-card__tag">Design</span>
<h3>The Power of Color Transitions</h3>
<p>How gradients transform flat interfaces into dynamic experiences.</p>
<a href="#">Read article →</a>
</div>
</article>
.gradient-card {
background: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
transition: transform 0.3s, box-shadow 0.3s;
}
.gradient-card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}
.gradient-card__accent {
height: 6px;
background: linear-gradient(90deg, #667eea, #764ba2, #f857a6);
}
.gradient-card__content {
padding: 28px;
}
.gradient-card__tag {
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.1em;
background: linear-gradient(135deg, #667eea, #764ba2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.gradient-card h3 {
font-size: 1.375rem;
margin: 12px 0;
color: #1a1a1a;
}
.gradient-card p {
color: #666666;
line-height: 1.6;
margin: 0 0 20px;
}
.gradient-card a {
color: #667eea;
text-decoration: none;
font-weight: 600;
}
Gradient Text
/* Gradient applied to text */
.gradient-text {
font-size: 4rem;
font-weight: 900;
background: linear-gradient(135deg, #667eea 0%, #f857a6 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
/* Animated gradient text */
.gradient-text-animated {
font-size: 4rem;
font-weight: 900;
background: linear-gradient(270deg, #667eea, #f857a6, #ff5858, #667eea);
background-size: 300% 300%;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
animation: gradient-shift 6s ease infinite;
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
Duotone Image Effect
<div class="duotone-image">
<img src="photo.jpg" alt="Team photo">
</div>
/* Method 1: CSS filter + mix-blend-mode */
.duotone-image {
position: relative;
overflow: hidden;
}
.duotone-image::before {
content: '';
position: absolute;
inset: 0;
background: #667eea;
mix-blend-mode: lighten;
z-index: 1;
}
.duotone-image::after {
content: '';
position: absolute;
inset: 0;
background: #f857a6;
mix-blend-mode: multiply;
z-index: 2;
}
.duotone-image img {
width: 100%;
display: block;
filter: grayscale(100%) contrast(1.2);
}
/* Method 2: SVG filter for precise control */
/*
<svg style="display:none">
<filter id="duotone">
<feColorMatrix type="matrix"
values="0.2 0 0 0 0.4
0 0.2 0 0 0.3
0 0 0.2 0 0.7
0 0 0 1 0"/>
</filter>
</svg>
*/
.duotone-svg {
filter: url(#duotone);
}
Mesh Gradient Background
/* Approximate mesh gradient with multiple radial gradients */
.mesh-gradient {
background-color: #667eea;
background-image:
radial-gradient(at 40% 20%, #f857a6 0px, transparent 50%),
radial-gradient(at 80% 0%, #764ba2 0px, transparent 50%),
radial-gradient(at 0% 50%, #00c6fb 0px, transparent 50%),
radial-gradient(at 80% 50%, #ff5858 0px, transparent 50%),
radial-gradient(at 0% 100%, #667eea 0px, transparent 50%),
radial-gradient(at 80% 100%, #38ef7d 0px, transparent 50%);
}
Gradient Border
/* Gradient border using background-clip */
.gradient-border {
background: linear-gradient(#ffffff, #ffffff) padding-box,
linear-gradient(135deg, #667eea, #f857a6) border-box;
border: 3px solid transparent;
border-radius: 12px;
padding: 24px;
}
/* Gradient border on hover */
.gradient-border-hover {
border: 3px solid #e0e0e0;
border-radius: 12px;
padding: 24px;
transition: border-color 0.3s;
}
.gradient-border-hover:hover {
background: linear-gradient(#ffffff, #ffffff) padding-box,
linear-gradient(135deg, #667eea, #f857a6) border-box;
border-color: transparent;
}
Gradient Direction Guide
| Angle | Direction | Feel |
|---|---|---|
0deg | Bottom to top | Rising, uplifting |
90deg | Left to right | Forward motion |
135deg | Top-left to bottom-right | Natural reading flow |
180deg | Top to bottom | Grounding, settling |
45deg | Bottom-left to top-right | Energetic, ascending |
When to Use Gradients/Duotone
Perfect For
- Landing pages: Attention-grabbing hero sections
- Social media/Apps: Vibrant, youthful brand identity
- Music/Entertainment: Energetic and expressive
- SaaS/Startup: Modern, dynamic tech feel
- Marketing campaigns: Memorable and eye-catching
Real-World Examples
- Instagram - Iconic gradient logo
- Spotify - Duotone album art and marketing
- Stripe - Gradient backgrounds and animations
- Apple Music - Gradient UI elements
- Asana - Colorful gradient illustrations
Avoid For
- Print-heavy designs: Gradients can be hard to reproduce
- Low-bandwidth users: Complex gradients are CSS-heavy
- Formal/Conservative brands: Law firms, government
- Accessibility-critical: Low contrast risks
Pros and Cons
Advantages
- ✅ Immediately eye-catching and modern
- ✅ Pure CSS; no image assets needed
- ✅ Infinite color combinations
- ✅ Creates depth without shadows
- ✅ Strong brand recognition
- ✅ Duotone unifies mixed photography
Disadvantages
- ❌ Readability issues with text on gradients
- ❌ Can look dated quickly (trends cycle fast)
- ❌ Print reproduction challenges
- ❌ Easy to overdo (gradient fatigue)
- ❌ Accessibility risks with insufficient contrast
- ❌ Some gradients render differently across browsers
Common Mistakes
1. Too Many Colors
Wrong: Rainbow gradients with 5+ colors.
Right: Stick to 2-3 colors maximum.
/* Wrong - chaotic */
background: linear-gradient(135deg, red, orange, yellow, green, blue, purple);
/* Right - controlled */
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
2. Text Unreadable on Gradient
Wrong: Dark text on a dark gradient area.
Right: Ensure contrast throughout the entire gradient range.
/* Add a safe overlay for text */
.text-on-gradient::before {
content: '';
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.3);
}
3. Harsh Color Transitions
Wrong: Colors that create a muddy middle ground.
Right: Choose colors that blend naturally.
/* Wrong - muddy brown in the middle */
background: linear-gradient(135deg, #ff0000, #00ff00);
/* Right - smooth transition through analogous colors */
background: linear-gradient(135deg, #667eea, #764ba2);
4. Gradients Everywhere
Wrong: Every element has a different gradient.
Right: Use one signature gradient consistently.
Advanced Techniques
Animated Gradient Background
.animated-gradient {
background: linear-gradient(-45deg, #667eea, #764ba2, #f857a6, #ff5858);
background-size: 400% 400%;
animation: gradient-flow 15s ease infinite;
}
@keyframes gradient-flow {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
Conic Gradient Effects
/* Color wheel */
.color-wheel {
width: 200px;
height: 200px;
border-radius: 50%;
background: conic-gradient(
#ff0000, #ff8800, #ffff00,
#00ff00, #0088ff, #8800ff,
#ff0000
);
}
/* Pie chart segment */
.pie-segment {
width: 200px;
height: 200px;
border-radius: 50%;
background: conic-gradient(
#667eea 0deg 216deg, /* 60% */
#f857a6 216deg 324deg, /* 30% */
#ffc947 324deg 360deg /* 10% */
);
}
Gradient Shadow
/* Colored shadow that matches the gradient */
.gradient-shadow {
background: linear-gradient(135deg, #667eea, #764ba2);
border-radius: 12px;
position: relative;
}
.gradient-shadow::after {
content: '';
position: absolute;
inset: 6px;
background: inherit;
border-radius: inherit;
filter: blur(20px);
opacity: 0.6;
z-index: -1;
transform: translateY(10px);
}
Noise Texture Over Gradient
/* Add grain to smooth gradients */
.gradient-noise {
background: linear-gradient(135deg, #667eea, #764ba2);
position: relative;
}
.gradient-noise::after {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
pointer-events: none;
}
Gradient Combinations That Work
| Name | Colors | Mood |
|---|---|---|
| Purple Bliss | #DA22FF → #9733EE | Creative, premium |
| Sunrise | #FF512F → #F09819 | Warm, energetic |
| Cool Blues | #2193b0 → #6dd5ed | Calm, professional |
| Pastel Dream | #a8edea → #fed6e3 | Soft, friendly |
| Dark Knight | #232526 → #414345 | Serious, modern |
| Aqua Marine | #1A2980 → #26D0CE | Fresh, tech |
| Cherry | #EB3349 → #F45C43 | Bold, urgent |
Checklist for Gradient/Duotone Design
- [ ] Maximum 2-3 colors per gradient
- [ ] Colors blend smoothly (no muddy middle tones)
- [ ] Text over gradients has sufficient contrast (test both ends)
- [ ] Signature gradient is used consistently across brand
- [ ] Fallback solid color defined for older browsers
- [ ] Animated gradients use GPU-friendly properties
- [ ] Not overused; strategic placement only
- [ ] Duotone unifies photography across the site
- [ ] Print-ready alternatives considered
- [ ] Tested across browsers for consistent rendering
Resources
Gradient Generators
- UI Gradients - Curated gradient collection
- WebGradients - 180 free gradients
- CSS Gradient - Visual gradient editor
- Mesh Gradient - Complex gradient generator
- Coolors Gradient - Custom gradient maker
Duotone Tools
- Duotone by ShapeFactory - Image duotone generator
- Colofilter - CSS duotone filters
Inspiration
- Dribbble - Gradients
- Gradient Hunt - Community gradients
- Grabient - Gradient CSS tool