エンジニアリング技術リファレンス100% 100% クライアント側実行

RGB vs HEX vs HSL: 最適なCSSカラーモデルの選び方

Webデザイナーやフロントエンドエンジニアがアクセシブルで保守性の高いUIシステムを構築するためのカラー記法ガイド。

技術判定・要約

スタイルガイドやFigma連携の簡潔なデザイントークンにはHEXを使用してください。Canvas描画やマシン処理にはRGBを使用してください。動的なUIテーマ切り替えやホバーステートには、色相・彩度・明度をCSS変数で数理的に調整できるHSLを使用してください。

機能・仕様比較マトリクス

技術仕様に基づく直接比較
評価軸HEX (#)RGB / RGBAHSL / HSLA
構文形式#6366f1 or #6366f180rgb(99, 102, 241) / rgba(...)hsl(239, 84%, 67%) / hsla(...)
直感的な可読性Low (Hexadecimal base-16)Medium (Red/Green/Blue 0-255)High (Angle 0-360°, % lightness)
アルファ透明度8-digit hex (#rrggbbaa)rgba(r, g, b, alpha)hsla(h, s, l, alpha)
テーマ調整の容易さDifficult without preprocessorDifficult to lighten/darken linearlyTrivial (Adjust lightness % directly)
ブラウザ互換性100% All Browsers100% All Browsers100% Modern Browsers

メリット&デメリット(トレードオフ)

アーキテクチャ選定における重要検討事項

HSL (Hue, Saturation, Lightness)

主な利点・強み

  • ✓Predictable color tweaks: increase L for hover states, decrease L for active states
  • ✓Ideal for CSS Custom Properties (--primary-h: 239; --primary-s: 84%;)
  • ✓Intuitive color wheel angle mapping

留意点・制約事項

  • ✕Perceptual lightness is not uniform across colors (pure yellow looks much brighter than pure blue at 50% lightness)

HEX

主な利点・強み

  • ✓Shortest character footprint in CSS and HTML stylesheets
  • ✓Universally copied from Photoshop, Figma, and Illustrator

留意点・制約事項

  • ✕Difficult to mentally estimate the color without a visual previewer

この比較に関する対話型ツールを起動

ブラウザ内で100%プライベートに動作するクライアントサンドボックス

よくある質問

Clear answers to common engineering questions
Why is HSL better for dark/light themes?

Because you can keep Hue and Saturation identical while simply swapping the Lightness percentage (e.g. 15% for dark mode backgrounds, 95% for light mode backgrounds).

How does HEX alpha transparency work?

In 8-digit hex like #6366f180, the last two hex digits represent alpha from 00 (0% opacity) to FF (100% opacity). 80 corresponds to roughly 50% opacity.

Offline Mode — Loaded tools run 100% locally