CSS named color

Purple #800080

The CSS keyword purple is #800080. It is a dark vivid magenta in the violet family. In OKLCH it sits at lightness 0.421, chroma 0.193 and hue 328.4°.

Relative luminance
0.0615
OKLCH L · C · h
0.421 · 0.193 · 328.4
Best text
White 9.41:1
Hue family
Violet

#800080 color codes

HEX
#800080
RGB
rgb(128, 0, 128)
HSL
hsl(300, 100%, 25%)
OKLCH
oklch(0.421 0.193 328.4)
OKLab
oklab(0.421 0.165 -0.101)
CIELAB (D65)
L* 29.78, a* 58.93, b* -36.49
XYZ (D65)
X 12.80, Y 6.15, Z 20.93
CMYK (naive)
cmyk(0%, 100%, 0%, 50%)

CIELAB and XYZ use the D65 white point; CSS lab() uses D50, so paste the OKLCH or HEX value into stylesheets. CMYK here is a plain formula with no press profile.

Legibility

Contrast: is #800080 accessible?

White text on it reaches 9.41:1, passing AAA. Black text fails at 2.22:1.

WCAG 2 gives the same ratio whichever color is the text; APCA does not, so its Lc changes sign and size with polarity.

Open the Contrast System
  • Black text on it

    2.22:1

    • AA fails
    • AA large fails
    • AAA fails
    • APCA Lc +14
  • White text on it

    9.41:1

    • AA passes
    • AA large passes
    • AAA passes
    • APCA Lc −94
  • As text on black

    2.22:1

    • AA fails
    • AA large fails
    • AAA fails
    • APCA Lc −12
  • As text on white

    9.41:1

    • AA passes
    • AA large passes
    • AAA passes
    • APCA Lc +89

Nearest versions that pass 4.5:1

  • For text on white

    #800080 9.41:1

    It already reaches 9.41:1 on white, so no change is needed.

  • For text on black

    #B646B4 4.52:1

    Lightening its OKLCH lightness from 0.42 to 0.59 reaches 4.52:1 on black, keeping the hue.

Checking another pair? Use the Contrast Checker.

Studio

Adjust #800080 live

Move lightness, chroma and hue in OKLCH, or drag on the map. The map is every lightness and chroma at the current hue: sRGB inside the solid area, Display P3 out to the dashed line.

The studio needs JavaScript.

Scale

Shades and tints of #800080

Eleven OKLCH lightness steps at this hue, each with its contrast against white and black. #800080 sits at step 700.

  1. 50#FFF0FE
    White
    1.09
    Black
    19.14
  2. 100#FFE0FD
    White
    1.21
    Black
    17.33
  3. 200#FFBEFB
    White
    1.49
    Black
    14.01
  4. 300#FB8FF8
    White
    2.02
    Black
    10.38
  5. 400#DF70DC
    White
    2.80
    Black
    7.48
  6. 500#C151BF
    White
    4.04
    Black
    5.19
  7. 600#A638A5
    White
    5.62
    Black
    3.73
  8. 700This color#800080
    White
    9.41
    Black
    2.22
  9. 800#6B006B
    White
    11.42
    Black
    1.83
  10. 900#470047
    White
    15.45
    Black
    1.35
  11. 950#2A002A
    White
    18.55
    Black
    1.13

Under each step, white and black text on it; a bold figure passes 4.5:1.

Gamut

How vivid #800080 can get

At its lightness and hue, sRGB reaches OKLCH chroma 0.194; #800080 uses 100% of it. Display P3, which many recent phones and laptops show, reaches 0.212 there: 9% more.

0.00.20.40.60.80.20.40.60.8 460480500520540560580600620
  • sRGB
  • Display P3
  • Rec. 2020
  • Dominant wavelength
OKLCH chroma
0.193
sRGB edge
0.194
Display P3 edge
0.212
Rec. 2020 edge
0.244
Dominant wavelength
Complementary 549 nm
Excitation purity
67%
Chromaticity
x 0.3209, y 0.1542
  • This color#800080
  • Most vivid in sRGB#800080
  • Most vivid in Display P3oklch(0.421 0.212 328.4)

On a screen without Display P3 the last tile shows the sRGB edge instead.

Use the wider color where screens show it
.accent {
  color: #800080;
}
@media (color-gamut: p3) {
  .accent { color: color(display-p3 0.4712 0 0.5013); }
}

Mixing

Mixing #800080

Each row is the same mix worked out in a different space, with the halfway color at its end. sRGB, which older CSS gradients use, can sag gray or dark in the middle; OKLab keeps the lightness steps even; OKLCH holds chroma and hue as it goes.

White #FFFFFF

  • sRGB50%#C080C0
  • OKLab50%#C38CC0
  • OKLCH50%#C38CC0

Black #000000

  • sRGB50%#400040
  • OKLab50%#2E002E
  • OKLCH50%#2E002E

Its complement #005E23

  • sRGB50%#402F52
  • OKLab50%#594657
  • OKLCH50%#743D00
In CSS
/* A gradient and a mix, worked out in OKLCH */
background: linear-gradient(in oklch, #800080, white);
color: color-mix(in oklch, #800080 50%, white);

In use

#800080 in an interface

A button, a link, a heading, a focused field, an icon and a chart line in this color, on a light page and a dark one. Each check is a WCAG 2 contrast minimum: 1.4.3 for text, 1.4.11 for the rest.

Light page

  • Button labelText, 4.5:19.41:1 Passes
  • Link and body-size textText, 4.5:19.41:1 Passes
  • Large headingLarge text, 3:19.41:1 Passes
  • Icons, borders and focus ringsNon-text, 3:19.41:1 Passes

Dark page

  • Button labelText, 4.5:19.41:1 Passes
  • Link and body-size textText, 4.5:11.98:1 Fails
  • Large headingLarge text, 3:11.98:1 Fails
  • Icons, borders and focus ringsNon-text, 3:11.98:1 Fails

For text on this page, the nearest shade that passes is #C050BE 4.57:1

Color vision

How #800080 looks with color blindness

Achromatopsia changes it most, ΔE2000 27.3; tritanopia changes it least, 15.5.

Simulated with Machado et al. (2009) at full severity, in linear light.

Simulate a whole page What each type sees
  • Protanopia

    No working red (long-wavelength) cones

    #003D83 ΔE2000 26.2

    Distinct

    Reads as dark soft blue

  • Deuteranopia

    No working green (medium-wavelength) cones

    #304B7D ΔE2000 26.0

    Distinct

    Reads as dark muted blue

  • Tritanopia

    No working blue (short-wavelength) cones

    #842149 ΔE2000 15.5

    Distinct

    Reads as dark soft wine

  • Achromatopsia

    No cone color vision; lightness only

    #464646 ΔE2000 27.3

    Distinct

    Reads as dark gray

Pairing check

Checked against its complement, #005E23. Their lightness contrast is only 1.17:1, so where hue collapses, add a label, icon or pattern.

VisionThe pairΔE2000Verdict
Normal vision#800080 · #005E2374.0Stays distinct
Protanopia#003D83 · #5F541D47.1Stays distinct
Deuteranopia#304B7D · #564E2837.5Stays distinct
Tritanopia#842149 · #005C5145.3Stays distinct
Achromatopsia#464646 · #5151513.8Easily confused

Harmony

Color harmonies for #800080

Its complement is #005E23, a dark soft green.

Hue rotations in OKLCH, mapped into sRGB by trimming chroma so hue and lightness stay put.

Open the Harmony Studio
  • Base#800080
  • Complement#005E23

Complementary

Open in Harmony Studio
  • −30°#5E21A6
  • Base#800080
  • +30°#8F004C
  • Base#800080
  • +120°#614A00
  • +240°#005862
  • Base#800080
  • +150°#495400
  • +210°#005B4E

Split-complementary

Open in Harmony Studio

Code

Design tokens

Ready-to-paste tokens in six formats. Rename them to fit your system.

CSS custom property

:root {
  --color-purple: #800080;
}

Tailwind config

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        purple: '#800080',
      },
    },
  },
};

Tailwind v4 theme

/* app.css — Tailwind CSS v4 */
@import "tailwindcss";

@theme {
  --color-purple: oklch(0.421 0.193 328.4);
}

Design token (W3C DTCG)

{
  "color": {
    "purple": {
      "$type": "color",
      "$value": {
        "colorSpace": "srgb",
        "components": [0.502, 0, 0.502],
        "hex": "#800080"
      },
      "$description": "CSS named color purple"
    }
  }
}

SwiftUI color

import SwiftUI

enum Palette {
    static let purple = Color(.sRGB, red: 0.502, green: 0.000, blue: 0.502, opacity: 1)
}

Jetpack Compose color

import androidx.compose.ui.graphics.Color

object Palette {
    val Purple = Color(0xFF800080)
}

Matches

The nearest match in each system

The closest CSS name, Tailwind shade, RAL Classic paint and Crayola crayon by ΔE2000; under 2 is hard to tell apart side by side. RAL and Crayola values approximate physical colors.

Tools

Open #800080 in the tools

Each opens over this page. More colors live in the Color Library, and every color page is listed on the hub.