Learn Colors
Master color theory and implementation in web design - hex, RGB, HSL, and gradients.
0 of 4 concepts completed (0%)
What You'll Learn
Tutorial Contents
1.Color Models & CSS
/* All equivalent colors */
.element {
color: #6200EE; /* hex */
color: rgb(98, 0, 238); /* RGB */
color: rgba(98, 0, 238, 0.8); /* RGB with alpha */
color: hsl(265, 100%, 47%); /* HSL most readable */
color: hsla(265, 100%, 47%, 0.8); /* HSL with alpha */
color: oklch(47% 0.27 265); /* OKLCH perceptually uniform *//* HSL palette generation (same hue, varying lightness) */ :root { --purple-100: hsl(265, 100%, 95%); --purple-200: hsl(265, 100%, 87%); --purple-300: hsl(265, 100%, 75%); --purple-400: hsl(265, 100%, 63%); --purple-500: hsl(265, 100%, 47%); /* base */ --purple-600: hsl(265, 100%, 38%); --purple-700: hsl(265, 100%, 30%); --purple-800: hsl(265, 100%, 22%); --purple-900: hsl(265, 100%, 15%); }
/* Gradients */ .hero { background: linear-gradient(135deg, #6200ee 0%, #03dac6 100%); }
.radial { background: radial-gradient(circle at 30% 50%, #6200ee, #03dac6); } ```
2.Contrast, Accessibility & Dark Mode
/* WCAG-compliant color system */
:root {
/* Light theme */
--bg: hsl(0, 0%, 100%);
--bg-muted: hsl(220, 14%, 96%);
--text: hsl(222, 47%, 11%);
--text-muted: hsl(217, 19%, 47%);/* Semantic colors */ --success: hsl(142, 71%, 35%); --warning: hsl(38, 92%, 45%); --error: hsl(0, 84%, 47%); --info: hsl(210, 90%, 42%); }
@media (prefers-color-scheme: dark) { :root { --bg: hsl(222, 47%, 11%); --bg-muted: hsl(220, 39%, 16%); --text: hsl(0, 0%, 100%); --text-muted: hsl(217, 19%, 65%); --primary: hsl(265, 100%, 75%); /* lighter for dark bg */ } }
/* Apply semantic tokens */ body { background: var(--bg); color: var(--text); } .muted { color: var(--text-muted); } .btn-primary { background: var(--primary); } ```
Code Example
/* Different color formats */
.element1 { color: #FF5733; } /* Hex */
.element2 { color: rgb(255, 87, 51); } /* RGB */
.element3 { color: hsl(9, 100%, 60%); } /* HSL */
/* Gradient */
.gradient {
background: linear-gradient(
135deg,
#667eea 0%,
#764ba2 100%
);
}Pro Tips
- 1Use HSL (hue, saturation, lightness) instead of hex for programmatic color generation it's much easier to create tints and shades by adjusting lightness.
- 2The WCAG AA standard requires 4.5:1 contrast ratio for normal text. Use browser DevTools or Polypane to check every text/background combo.
- 3Build a color palette with 5-10 shades per hue (100-900). This gives designers and developers consistent options without introducing new arbitrary values.
- 4Never rely on color alone to convey information about 8% of men have some form of color blindness. Always pair color with shape, text, or pattern.
Topics Covered
Continue Learning
Explore the official documentation and deepen your knowledge with real-world practice.
Explore the Full Portfolio
This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.
The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.
For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.