OKLCH ↔ RGB Color Converter

Convert between OKLCH and RGB color formats with real-time preview

OKLCH Color

oklch(0.628 0.258 29)

RGB Color

rgb(255, 0, 0)

Color Values & CSS Code

OKLCH
oklch(0.628 0.258 29)
RGB
rgb(255, 0, 0)
HEX
#ff0000

CSS Implementation

.color-example {
  /* OKLCH format (modern) */
  color: oklch(0.628 0.258 29);
  
  /* RGB format (universal) */
  background-color: rgb(255, 0, 0);
  
  /* HEX fallback */
  border-color: #ff0000;
}

JavaScript Implementation

// Current color values
const oklchColor = { l: 0.628, c: 0.258, h: 29 };
const rgbColor = { r: 255, g: 0, b: 0 };

// Convert OKLCH to RGB
const convertedRgb = oklchToRgb(oklchColor);

// Convert RGB to OKLCH  
const convertedOklch = rgbToOklch(rgbColor);