Understand what hue is in color theory, how it's measured, and its importance in digital design and color selection.
Hue is the fundamental attribute of color that allows it to be classified as red, blue, green, yellow, or any other distinct color family. It represents the dominant wavelength of light that is perceived by the human visual system and forms the foundation of all color theory and color reproduction systems.
Transform color theory principles into stunning, professional palettes with our AI-powered color tools designed for designers and creators.
Generate harmonious color schemes from images or base colors • Get AI-powered color theory recommendations • Export professional palettes instantly
Hue is one of the three primary dimensions of color perception, alongside saturation and lightness. It is defined by the dominant wavelength of electromagnetic radiation in the visible spectrum (approximately 380-700 nanometers) that is reflected from or transmitted through an object.
Hue perception is based on the wavelength composition of light reaching the human eye. Different wavelengths stimulate the three types of cone cells in the retina to varying degrees:
Some hues, like magenta and purple, don't correspond to single wavelengths but result from combinations of different wavelengths stimulating multiple cone types simultaneously.
In most color models, hue is represented as an angle on a color wheel from 0° to 360°:
Here's how to extract hue from RGB values:
function rgbToHue(r, g, b) {
// Normalize RGB values to 0-1 range
r /= 255;
g /= 255;
b /= 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const delta = max - min;
let hue = 0;
if (delta !== 0) {
if (max === r) {
hue = ((g - b) / delta) % 6;
} else if (max === g) {
hue = (b - r) / delta + 2;
} else {
hue = (r - g) / delta + 4;
}
}
hue = Math.round(hue * 60);
// Ensure positive angle
if (hue < 0) {
hue += 360;
}
return hue;
}
// Example usage
const hue = rgbToHue(255, 128, 0); // Orange: ~30°
console.log(`Hue: ${hue}°`);In the HSL color model, hue forms the primary component that determines the base color family:
/* HSL examples with varying hue */
hsl(0, 100%, 50%) /* Pure Red */
hsl(30, 100%, 50%) /* Orange */
hsl(60, 100%, 50%) /* Yellow */
hsl(120, 100%, 50%) /* Green */
hsl(180, 100%, 50%) /* Cyan */
hsl(240, 100%, 50%) /* Blue */
hsl(300, 100%, 50%) /* Magenta */
/* Same hue with different saturation and lightness */
hsl(240, 100%, 50%) /* Pure Blue */
hsl(240, 50%, 50%) /* Muted Blue */
hsl(240, 100%, 75%) /* Light Blue */
hsl(240, 100%, 25%) /* Dark Blue */The HSV color model also uses hue as its primary component:
function hslToHsv(h, s, l) {
// Convert HSL to HSV while preserving hue
const value = l + s * Math.min(l, 1 - l);
const saturation = value === 0 ? 0 : 2 * (1 - l / value);
return {
hue: h, // Hue remains the same
saturation: saturation * 100,
value: value * 100
};
}In perceptually uniform color spaces like LCH, hue is measured more accurately relative to human perception:
/* LCH color with specific hue angles */
lch(50% 50 0) /* Red hue */
lch(50% 50 90) /* Yellow hue */
lch(50% 50 180) /* Cyan hue */
lch(50% 50 270) /* Blue hue */Complementary colors are hues that are 180° apart on the color wheel:
function getComplementaryHue(hue) {
return (hue + 180) % 360;
}
// Examples
console.log(getComplementaryHue(0)); // 180° (Cyan complements Red)
console.log(getComplementaryHue(60)); // 240° (Blue complements Yellow)
console.log(getComplementaryHue(120)); // 300° (Magenta complements Green)Analogous colors are hues that are adjacent on the color wheel (typically within 30° of each other):
function getAnalogousHues(baseHue, range = 30) {
return {
left: (baseHue - range + 360) % 360,
center: baseHue,
right: (baseHue + range) % 360
};
}
// Example: Analogous hues for blue (240°)
const analogous = getAnalogousHues(240);
console.log(analogous); // { left: 210, center: 240, right: 270 }Triadic color schemes use three hues that are evenly spaced around the color wheel (120° apart):
function getTriadicHues(baseHue) {
return [
baseHue,
(baseHue + 120) % 360,
(baseHue + 240) % 360
];
}
// Example: Triadic scheme starting with red
const triadic = getTriadicHues(0);
console.log(triadic); // [0, 120, 240] - Red, Green, BlueHue shifting involves rotating colors around the color wheel:
class HueManipulator {
static shiftHue(r, g, b, shiftDegrees) {
// Convert RGB to HSL
const hsl = this.rgbToHsl(r, g, b);
// Shift the hue
hsl.h = (hsl.h + shiftDegrees + 360) % 360;
// Convert back to RGB
return this.hslToRgb(hsl.h, hsl.s, hsl.l);
}
static rgbToHsl(r, g, b) {
r /= 255; g /= 255; b /= 255;
const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
const delta = max - min;
let h = 0, s = 0, l = (max + min) / 2;
if (delta !== 0) {
s = l > 0.5 ? delta / (2 - max - min) : delta / (max + min);
switch (max) {
case r: h = (g - b) / delta + (g < b ? 6 : 0); break;
case g: h = (b - r) / delta + 2; break;
case b: h = (r - g) / delta + 4; break;
}
h /= 6;
}
return { h: h * 360, s: s * 100, l: l * 100 };
}
static hslToRgb(h, s, l) {
h /= 360; s /= 100; l /= 100;
const hue2rgb = (p, q, t) => {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1/6) return p + (q - p) * 6 * t;
if (t < 1/2) return q;
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
};
let r, g, b;
if (s === 0) {
r = g = b = l; // Achromatic
} else {
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(b * 255)
};
}
}
// Example: Shift red by 60° to get yellow
const shifted = HueManipulator.shiftHue(255, 0, 0, 60);
console.log(shifted); // Approximately yellowSmooth transitions between hues require careful interpolation:
function interpolateHue(hue1, hue2, factor) {
// Handle the circular nature of hue
let diff = hue2 - hue1;
// Take the shorter path around the circle
if (diff > 180) {
diff -= 360;
} else if (diff < -180) {
diff += 360;
}
let result = hue1 + diff * factor;
// Normalize to 0-360 range
if (result < 0) result += 360;
if (result >= 360) result -= 360;
return result;
}
// Example: Interpolate between red (0°) and blue (240°)
for (let i = 0; i <= 10; i++) {
const factor = i / 10;
const hue = interpolateHue(0, 240, factor);
console.log(`Step ${i}: ${hue.toFixed(1)}°`);
}Human hue discrimination varies across the spectrum:
The human visual system maintains relatively stable hue perception under different lighting conditions through chromatic adaptation:
// Simplified chromatic adaptation for hue preservation
function adaptHue(originalHue, illuminantShift) {
// Bradford transform approach for hue adaptation
const adaptationMatrix = [
[0.8951, 0.2664, -0.1614],
[-0.7502, 1.7135, 0.0367],
[0.0389, -0.0685, 1.0296]
];
// Apply adaptation while preserving hue relationships
// (Simplified implementation)
return (originalHue + illuminantShift) % 360;
}Hue is fundamental in CSS color specifications:
/* CSS Custom Properties for hue-based color schemes */
:root {
--primary-hue: 220;
--secondary-hue: calc(var(--primary-hue) + 180);
--accent-hue: calc(var(--primary-hue) + 60);
}
.primary { color: hsl(var(--primary-hue), 70%, 50%); }
.secondary { color: hsl(var(--secondary-hue), 70%, 50%); }
.accent { color: hsl(var(--accent-hue), 70%, 50%); }
/* Dynamic hue adjustment with CSS */
.hue-shift {
filter: hue-rotate(45deg);
transition: filter 0.3s ease;
}
.hue-shift:hover {
filter: hue-rotate(90deg);
}Hue-based image adjustments are common in photo editing:
class ImageHueProcessor {
static adjustHue(imageData, hueShift) {
const data = imageData.data;
for (let i = 0; i < data.length; i += 4) {
const r = data[i];
const g = data[i + 1];
const b = data[i + 2];
// Convert to HSL, adjust hue, convert back
const adjusted = HueManipulator.shiftHue(r, g, b, hueShift);
data[i] = adjusted.r;
data[i + 1] = adjusted.g;
data[i + 2] = adjusted.b;
// Alpha channel (data[i + 3]) remains unchanged
}
return imageData;
}
static createHueGradient(width, height) {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d');
const gradient = ctx.createLinearGradient(0, 0, width, 0);
// Create rainbow gradient across all hues
for (let i = 0; i <= 360; i += 60) {
const position = i / 360;
gradient.addColorStop(position, `hsl(${i}, 100%, 50%)`);
}
ctx.fillStyle = gradient;
ctx.fillRect(0, 0, width, height);
return canvas;
}
}Different color spaces handle hue linearity differently:
// Compare hue linearity between color spaces
function compareHueLinearity(hue1, hue2) {
const hslDiff = Math.abs(hue2 - hue1);
const hslDiffNormalized = Math.min(hslDiff, 360 - hslDiff);
// LCH provides more perceptually uniform hue differences
const lchDiff = calculateLCHHueDifference(hue1, hue2);
return {
hslDifference: hslDiffNormalized,
lchDifference: lchDiff,
perceptualAccuracy: lchDiff / hslDiffNormalized
};
}
function calculateLCHHueDifference(h1, h2) {
// Simplified LCH hue difference calculation
// In practice, this would involve complex color space conversions
const radians1 = (h1 * Math.PI) / 180;
const radians2 = (h2 * Math.PI) / 180;
const deltaH = 2 * Math.sin(Math.abs(radians2 - radians1) / 2);
return (deltaH * 180) / Math.PI;
}Understanding how hue perception changes with color vision deficiencies:
class ColorBlindnessSimulator {
static simulateProtanopia(r, g, b) {
// Simulate red-blind vision (affects red hues)
const matrix = [
[0.567, 0.433, 0.000],
[0.558, 0.442, 0.000],
[0.000, 0.242, 0.758]
];
return this.applyMatrix(r, g, b, matrix);
}
static simulateDeuteranopia(r, g, b) {
// Simulate green-blind vision (affects green hues)
const matrix = [
[0.625, 0.375, 0.000],
[0.700, 0.300, 0.000],
[0.000, 0.300, 0.700]
];
return this.applyMatrix(r, g, b, matrix);
}
static simulateTritanopia(r, g, b) {
// Simulate blue-blind vision (affects blue hues)
const matrix = [
[0.950, 0.050, 0.000],
[0.000, 0.433, 0.567],
[0.000, 0.475, 0.525]
];
return this.applyMatrix(r, g, b, matrix);
}
static applyMatrix(r, g, b, matrix) {
const nr = r/255, ng = g/255, nb = b/255;
return {
r: Math.round((matrix[0][0] * nr + matrix[0][1] * ng + matrix[0][2] * nb) * 255),
g: Math.round((matrix[1][0] * nr + matrix[1][1] * ng + matrix[1][2] * nb) * 255),
b: Math.round((matrix[2][0] * nr + matrix[2][1] * ng + matrix[2][2] * nb) * 255)
};
}
}Hue accuracy is critical in print color management:
// Hue-preserving CMYK conversion
function preserveHueInCMYK(r, g, b) {
// Extract original hue
const originalHue = rgbToHue(r, g, b);
// Convert to CMYK
const cmyk = rgbToCmyk(r, g, b);
// Convert back to RGB to check hue shift
const backConverted = cmykToRgb(cmyk.c, cmyk.m, cmyk.y, cmyk.k);
const newHue = rgbToHue(backConverted.r, backConverted.g, backConverted.b);
// Apply hue correction if necessary
if (Math.abs(newHue - originalHue) > 5) {
const correction = originalHue - newHue;
return adjustCMYKHue(cmyk, correction);
}
return cmyk;
}
function adjustCMYKHue(cmyk, hueCorrection) {
// Simplified hue adjustment in CMYK space
// Professional implementations use ICC profiles
const factor = hueCorrection / 360;
return {
c: Math.max(0, Math.min(100, cmyk.c + factor * 10)),
m: Math.max(0, Math.min(100, cmyk.m - factor * 5)),
y: Math.max(0, Math.min(100, cmyk.y + factor * 15)),
k: cmyk.k
};
}Hue accuracy verification in display calibration:
class HueCalibrationTester {
static generateHueTestPattern() {
const testHues = [0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330];
const pattern = [];
testHues.forEach(hue => {
pattern.push({
hue: hue,
reference: `hsl(${hue}, 100%, 50%)`,
tolerance: 2, // ±2° acceptable deviation
description: this.getHueName(hue)
});
});
return pattern;
}
static getHueName(hue) {
const names = {
0: 'Red', 30: 'Red-Orange', 60: 'Yellow', 90: 'Yellow-Green',
120: 'Green', 150: 'Blue-Green', 180: 'Cyan', 210: 'Blue-Cyan',
240: 'Blue', 270: 'Blue-Violet', 300: 'Magenta', 330: 'Red-Violet'
};
return names[hue] || `${hue}°`;
}
static validateHueAccuracy(measuredRGB, expectedHue, tolerance = 2) {
const measuredHue = rgbToHue(measuredRGB.r, measuredRGB.g, measuredRGB.b);
const difference = Math.abs(measuredHue - expectedHue);
const circularDifference = Math.min(difference, 360 - difference);
return {
passed: circularDifference <= tolerance,
measuredHue: measuredHue,
expectedHue: expectedHue,
difference: circularDifference,
tolerance: tolerance
};
}
}// Hue-preserving color operations
class HuePreservingOperations {
static adjustBrightness(r, g, b, factor) {
// Convert to HSL to preserve hue
const hsl = HueManipulator.rgbToHsl(r, g, b);
// Adjust lightness while preserving hue and saturation
hsl.l = Math.max(0, Math.min(100, hsl.l * factor));
return HueManipulator.hslToRgb(hsl.h, hsl.s, hsl.l);
}
static adjustSaturation(r, g, b, factor) {
const hsl = HueManipulator.rgbToHsl(r, g, b);
// Adjust saturation while preserving hue and lightness
hsl.s = Math.max(0, Math.min(100, hsl.s * factor));
return HueManipulator.hslToRgb(hsl.h, hsl.s, hsl.l);
}
static gamutClampPreserveHue(r, g, b, targetGamut = 'sRGB') {
// Clamp to gamut while minimizing hue shift
const originalHue = rgbToHue(r, g, b);
// Clamp RGB values
const clamped = {
r: Math.max(0, Math.min(255, r)),
g: Math.max(0, Math.min(255, g)),
b: Math.max(0, Math.min(255, b))
};
// Check if hue was preserved
const clampedHue = rgbToHue(clamped.r, clamped.g, clamped.b);
if (Math.abs(clampedHue - originalHue) > 1) {
// Restore original hue by adjusting in HSL space
const hsl = HueManipulator.rgbToHsl(clamped.r, clamped.g, clamped.b);
hsl.h = originalHue;
return HueManipulator.hslToRgb(hsl.h, hsl.s, hsl.l);
}
return clamped;
}
}Hue representation and manipulation continue to evolve with advances in display technology and color science:
Hue forms the foundation of color theory and digital color reproduction. Understanding its mathematical representation, perceptual properties, and practical applications is essential for anyone working with color in digital media, print production, or display technology. From basic web design to advanced color management systems, hue remains the primary attribute that gives color its identity and emotional impact.
Whether you're developing color schemes, processing images, or calibrating displays, mastering hue manipulation and preservation techniques ensures accurate and visually appealing color reproduction across all media and applications.
Explore these comprehensive pillar articles related to Hue
Comprehensive guide to analogous color schemes - adjacent hues on the color wheel that create natural harmony, visual cohesion, and sophisticated design solutions through subtle color relationships and graduated transitions.
A comprehensive guide to color theory, its fundamental principles, and practical applications in digital design and web development.
Comprehensive guide to complementary colors - opposing hues on the color wheel that create maximum visual contrast, dynamic tension, and powerful design impact through scientific color relationships and perceptual phenomena.
Comprehensive guide to triadic color schemes - three colors evenly spaced around the color wheel that create balanced, vibrant, and dynamic visual compositions with mathematical precision and artistic appeal.
Discover more about Hue and related color theory concepts
Comprehensive guide to analogous color schemes - adjacent hues on the color wheel that create natural harmony, visual cohesion, and sophisticated design solutions through subtle color relationships and graduated transitions.
A comprehensive guide to color theory, its fundamental principles, and practical applications in digital design and web development.
Comprehensive guide to complementary colors - opposing hues on the color wheel that create maximum visual contrast, dynamic tension, and powerful design impact through scientific color relationships and perceptual phenomena.
A comprehensive guide to monochromatic color schemes - sophisticated single-hue harmonies that create unified visual experiences through systematic variations in saturation, lightness, and tonal relationships, essential for elegant design compositions, brand consistency, and advanced color theory applications requiring cohesive aesthetic unity.
A comprehensive guide to split-complementary color schemes - sophisticated three-color harmonies that combine a base color with two colors adjacent to its complement, creating balanced visual contrast with reduced tension compared to direct complementary pairs, essential for refined design compositions, brand identity systems, and advanced color theory applications.
A comprehensive guide to tetradic color schemes - sophisticated four-color harmonies that use two complementary pairs arranged in rectangular or square formations on the color wheel, providing maximum color variety while maintaining structured relationships essential for dynamic design compositions, brand systems, and advanced color theory applications.
Discover more color terminology and concepts in our comprehensive glossary.
Browse Full Glossary