Hexadecimal Colors in Web Design

Comprendere #RRGGBB

Impara Hex Colors

Every web designer encounters codes like #FF5733 o #2C3E50. These hexadecimal color codes sono un compact way un specify colors usando il same number system programmers usare per binary data. Comprendere hex colors unlocks precise color control in web design.

How Hex Colors Work

RGB Color Model

Digital screens create colors da combining red, green, e blue light.

  • Each channel ha 256 intensity levels (0-255)
  • 0 = no light, 255 = full intensity
  • 256 × 256 × 256 = 16.7 million possible colors

Hexadecimal Representation

  • 256 values = FF in hex (two hex digits)
  • More compact than decimal (255,128,0 vs FF8000)
  • Easy un type e remember

Esempio: #FF5733

  • FF = 255 red (maximum)
  • 57 = 87 green (moderate)
  • 33 = 51 blue (low)
  • Risultato: Bright orange-red color

Comuni Color Values

ColorHex CodeRGB
Black#0000000, 0, 0
White#FFFFFF255, 255, 255
Red#FF0000255, 0, 0
Green#00FF000, 255, 0
Blue#0000FF0, 0, 255
Yellow#FFFF00255, 255, 0
Cyan#00FFFF0, 255, 255
Magenta#FF00FF255, 0, 255
Gray#808080128, 128, 128

Shorthand Hex Colors

CSS allows 3-digit shorthand quando both digits in each pair sono il same.

Come Funziona

  • #RGB expands un #RRGGBB
  • Each digit e doubled

Esempi

  • #FFF = #FFFFFF (white)
  • #000 = #000000 (black)
  • #F00 = #FF0000 (red)
  • #369 = #336699 (steel blue)

Limitation

#FF5733 cannot be shortened (57 ≠ 55 o 77)

Hex con Alpha (Transparency)

8-Digit Hex: #RRGGBBAA

Modern CSS supports adding alpha channel:

  • AA = opacity (00 = transparent, FF = opaque)
  • #FF573380 = 50% transparent orange-red

Comuni Alpha Values

  • FF = 100% opaque
  • CC = ~80% opaque
  • 80 = 50% opaque
  • 40 = 25% opaque
  • 00 = fully transparent

Convertendo Hex un RGB

Method

  1. Take each 2-digit pair
  2. Converti da hex un decimal

Esempio: #4A90D9

  • 4A = 4×16 + 10 = 74 red
  • 90 = 9×16 + 0 = 144 green
  • D9 = 13×16 + 9 = 217 blue
  • RGB: rgb(74, 144, 217)

Quick Riferimento

  • 00 = 0
  • 40 = 64
  • 80 = 128
  • C0 = 192
  • FF = 255

Convertendo RGB un Hex

Method

  1. Converti each decimal value (0-255) un hex (00-FF)
  2. Combine con # prefix

Esempio: rgb(100, 200, 150)

  • 100 = 64 (6×16 + 4)
  • 200 = C8 (12×16 + 8)
  • 150 = 96 (9×16 + 6)
  • Hex: #64C896

Quick Math

  • Divide da 16 = first digit
  • Remainder = secondo digit
  • 100 ÷ 16 = 6 remainder 4 → 64

Using Hex Colors in CSS

Standard Usage

color: #FF5733;

background-color: #2C3E50;

border: 2px solid #E74C3C;

Alternative CSS Color Formats

  • rgb(255, 87, 51) - RGB decimal
  • rgba(255, 87, 51, 0.5) - RGB con alpha
  • hsl(9, 100%, 60%) - Hue, Saturation, Lightness

Quando un Usa Each

  • Hex: Most common, compact
  • RGB/RGBA: Quando calculating colors dynamically
  • HSL: Quando adjusting lightness/saturation

Popular Color Palettes in Hex

Material Design

  • Primary Blue: #2196F3
  • Green: #4CAF50
  • Red: #F44336
  • Purple: #9C27B0

Flat UI Colors

  • Turquoise: #1ABC9C
  • Emerald: #2ECC71
  • Wet Asphalt: #34495E
  • Alizarin: #E74C3C

Conclusione

Hexadecimal color codes sono un compact way un express RGB colors usando il base-16 number system. Each pair di digits (00-FF) represents one color channel's intensity da 0-255. Comprendere hex colors helps web designers work efficiently con color pickers, style sheets, e design tools. While tools puo do il conversione, knowing how hex colors work enables better color manipulation e quicker debugging.

Articoli Correlati

Hexadecimal Colors in Web Design: #RRGGBB Guide | YounitConverter