Introduction to CSS Colors.

Louis EbojieluLouis Ebojielu
2 min read

Mastering CSS Colors: A Complete Beginner's Guide

Colors are one of the first things you notice in a web page and also one of the most powerful tools whether you’re building a landing page, blog or an e-commerce store. CSS creates mood, reinforce brand identity, and improve readability. In CSS (Cascading Style Sheets), understanding how to control colors allows you to create beautiful, accessible, and memorable designs.


🌈 What Are CSS Colors?

CSS colors can be applied to text, backgrounds, borders, and even shadows. They help set the mood of a webpage—bold, minimal, vibrant, or soft.

Quote:
“Color does not add a pleasant quality to design—it reinforces it.”
Pierre Bonnard


🔢 1. Color Formats in CSS

There are several ways to define colors in CSS. Here’s a breakdown:


✅ Named Colors

CSS provides around 140 predefined color names like red, blue, crimson, mintcream.

cssCopyEdith1 {
  color: crimson;
}

📷 Example:

Named CSS Colors


✅ HEX Codes

The most common format. HEX stands for hexadecimal—a 6-digit code beginning with #.

cssCopyEditp {
  color: #3498db;
}

🔍 #3498db is a shade of blue.


✅ RGB and RGBA

RGB stands for Red, Green, Blue.

cssCopyEditbody {
  background-color: rgb(255, 255, 255); /* white */
}

Add transparency with RGBA:

cssCopyEditdiv {
  background-color: rgba(0, 0, 0, 0.5); /* semi-transparent black */
}

🧪 Quote:

“In design, color is king—but contrast is queen.”
Louis Ebojielu


✅ HSL and HSLA

HSL: Hue, Saturation, Lightness.

cssCopyEditsection {
  color: hsl(200, 70%, 50%);
}

Add alpha with HSLA for transparency.


🖼️ 2. Adding Background Images with Colors

You can even mix background images with colors:

cssCopyEdit.hero {
  background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)),
              url('https://source.unsplash.com/featured/?technology');
  background-size: cover;
}

📷 Image Example:


🎯 3. Color Accessibility Tips

Don’t just choose colors based on aesthetics—accessibility matters.

  • Use sufficient contrast between text and background

  • Avoid red-green combos for colorblind users

  • Tools like WebAIM Contrast Checker help test it


🛠️ 4. Tools for Choosing Colors

🎨 These tools help you build consistent palettes and gradients.


🚀 Final Thoughts

CSS Colors are simple to learn, but mastering them helps elevate your designs to the next level. Play with combinations, test for accessibility, and keep experimenting!


📌 “Design is intelligence made visible.” — Alina Wheeler

0
Subscribe to my newsletter

Read articles from Louis Ebojielu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Louis Ebojielu
Louis Ebojielu