Convert each RGB value (0-255) to hexadecimal (00-FF). RGB(255, 102, 0) = #FF6600. In code: hex = '#' + red.toString(16) + green.toString(16) + blue.toString(16). Pad with zeros if needed.
RGB is additive (light-based) for screens - R+G+B = white. CMYK is subtractive (ink-based) for printing - C+M+Y+K = black. Some RGB colors (especially bright blues and greens) cannot be reproduced in CMYK print.
Rotate hue by 180° on the color wheel. In HSV/HSL: new_hue = (hue + 180) % 360. In RGB: invert each channel (255 - value), though HSV rotation gives more visually pleasing results. Complementary colors create maximum contrast.
Both use Hue (color angle 0-360°) + Saturation. HSL (Lightness): L=0 is black, L=100 is white, L=50 is pure color. HSV (Value/Brightness): V=0 is black, V=100 is brightest. HSL is more intuitive for designers; HSV is common in color pickers.