Skip to content

CSS named color

Violet #EE82EE

Violet (CSS keyword violet) has the hex code #EE82EE and the RGB value rgb(238, 130, 238): a light, vivid magenta.

Violet#EE82EE

CSS violet (#ee82ee) is a light pinkish purple, far from spectral violet at the short-wavelength end of the rainbow. For a deep violet, use darkviolet.

Color codes for Violet

Color codes for Violet
CSS keywordviolet
HEX#EE82EE
RGBrgb(238, 130, 238)
HSLhsl(300, 76%, 72%)
HWBhwb(300 51% 7%)
OKLCHoklch(76.2% 0.186 327.2)
CMYK (naive, no ICC profile)cmyk(0%, 45%, 0%, 7%)
Decimal15,631,086
Hue familyPurples and violets

Contrast and accessibility

On violet, black text has a contrast ratio of 9.06:1 and passes AAA at any text size; white text reaches 2.31:1.

WCAG 2.2 contrast ratios (success criteria 1.4.3 and 1.4.6: AA needs 4.5:1 for normal text and 3:1 for large text, AAA needs 7:1 and 4.5:1). APCA Lc is the lightness contrast from the APCA-W3 0.0.98G model proposed for WCAG 3; a higher absolute value is more readable, and Lc 75 is its suggested minimum for body text.

Contrast and accessibility
PairRatioAAAA largeAAAAAA largeAPCA Lc
Black text on violet9.06:1PassPassPassPass58.7
White text on violet2.31:1FailFailFailFail−50.2
Violet text on white2.31:1FailFailFailFail45.3
Violet text on black9.06:1PassPassPassPass−56.8

Tints and shades

Each step mixes violet with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, violet, white 25%) in CSS.

Tints (mixed with white)

  1. 5%
    #ef88ef
  2. 15%
    #f195f1
  3. 25%
    #f2a1f2
  4. 35%
    #f4aef4
  5. 45%
    #f6baf6
  6. 55%
    #f7c7f7
  7. 65%
    #f9d3f9
  8. 75%
    #fbe0fb
  9. 85%
    #fcecfc
  10. 95%
    #fef9fe

Shades (mixed with black)

  1. 5%
    #e27ce2
  2. 15%
    #ca6fca
  3. 25%
    #b362b3
  4. 35%
    #9b559b
  5. 45%
    #834883
  6. 55%
    #6b3a6b
  7. 65%
    #532e53
  8. 75%
    #3c213c
  9. 85%
    #241424
  10. 95%
    #0c070c

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, violet's complementary color is #4CD067 (close to limegreen), its analogous colors are #BE98FF and #FF78B3, and its triadic partners are #E1A800 and #00CBE2. For text on top, black gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#4cd067
Analogous−30°, +30°#be98ff#ff78b3
Triadic+120°, +240°#e1a800#00cbe2
Split-complementary+150°, +210°#aabf00#00d2b0

Computed in OKLCH: the hue is rotated by 180° (complementary), ±30° (analogous), ±120° (triadic) and 180° ±30° (split-complementary) while lightness and chroma stay fixed. Results that fall outside sRGB are brought back with the CSS Color 4 gamut mapping algorithm. Because this uses OKLCH, the values differ from tools that rotate hue in HSL, but every color keeps the same perceived lightness.

Warm or cool?

Violet sits on the boundary: its hue of 300° on the HSL wheel is a magenta, which reads warm next to blues and cool next to reds and oranges.

Nearest named and Tailwind colors

Distance is ΔE OK, the Euclidean distance in OKLab multiplied by 100. Values under about 2 are hard to tell apart side by side.

Nearest CSS named colors

Nearest CSS named colors
ColorHEXΔE OK
orchid#da70d66.0
plum#dda0dd8.1
hotpink#ff69b48.9

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
fuchsia-400#ed6aff5.9
fuchsia-300#f4a8ff8.4
pink-400#fb64b68.9

Code snippets

CSS
.element {
  color: violet;
  background-color: #ee82ee;
  border-color: rgb(238 130 238);
  outline-color: oklch(76.2% 0.186 327.2);
}
Tailwind CSS
<div class="bg-[#ee82ee] text-black">...</div>

/* or register it once in your CSS (Tailwind v4) */
@theme {
  --color-violet: #ee82ee;
}
/* then use bg-violet, text-violet, border-violet */
SwiftUI
import SwiftUI

extension Color {
  static let violet = Color(red: 0.933, green: 0.510, blue: 0.933)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

val Violet = Color(0xFFEE82EE)
Flutter
import 'package:flutter/material.dart';

const violet = Color(0xFFEE82EE);
Android XML
<!-- res/values/colors.xml -->
<color name="violet">#EE82EE</color>

Frequently asked questions

What is the hex code for violet?
The hex code for violet is #EE82EE. The same color is rgb(238, 130, 238), hsl(300, 76%, 72%) and oklch(76.2% 0.186 327.2), and in CSS you can also write the keyword violet directly.
Is violet a warm or cool color?
Violet sits on the boundary: its hue of 300° on the HSL wheel is a magenta, which reads warm next to blues and cool next to reds and oranges.
What colors go with violet?
Rotating the hue in OKLCH while keeping lightness and chroma, violet's complementary color is #4CD067 (close to limegreen), its analogous colors are #BE98FF and #FF78B3, and its triadic partners are #E1A800 and #00CBE2. For text on top, black gives the higher contrast.
Can you use white text on violet?
White text on violet has a contrast ratio of 2.31:1, which fails AA even for large text under WCAG 2.2. Black text reaches 9.06:1 and passes both AA and AAA. In APCA terms that is Lc −50.2 for white and Lc 58.7 for black.
What is the RGB value of violet?
Violet is rgb(238, 130, 238): red 238, green 130 and blue 238 on the 0 to 255 scale, or 93.3%, 51.0% and 93.3%. As a decimal integer it is 15631086.

Last reviewed by Arielton Oberek.