CSS named color

Dark Violet #9400D3

The CSS keyword darkviolet is #9400D3. It is a vivid violet in the violet family. In OKLCH it sits at lightness 0.515, chroma 0.261 and hue 309.8°.

Relative luminance
0.1100
OKLCH L · C · h
0.515 · 0.261 · 309.8
Best text
White 6.56:1
Hue family
Violet

#9400D3 color codes

HEX
#9400D3
RGB
rgb(148, 0, 211)
HSL
hsl(282, 100%, 41%)
OKLCH
oklch(0.515 0.261 309.8)
OKLab
oklab(0.515 0.167 -0.200)
CIELAB (D65)
L* 39.58, a* 76.32, b* -70.37
XYZ (D65)
X 23.97, Y 11.00, Z 62.48
CMYK (naive)
cmyk(30%, 100%, 0%, 17%)

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 #9400D3 accessible?

White text on it reaches 6.56:1, passing AA. Black text manages only 3.19:1, enough for large text only.

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

    3.19:1

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

    6.56:1

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

    3.19:1

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

    6.56:1

    • AA passes
    • AA large passes
    • AAA fails
    • APCA Lc +80

Nearest versions that pass 4.5:1

  • For text on white

    #9400D3 6.56:1

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

  • For text on black

    #AD35EF 4.53:1

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

Checking another pair? Use the Contrast Checker.

Studio

Adjust #9400D3 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 #9400D3

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

  1. 50#F9F2FF
    White
    1.09
    Black
    19.17
  2. 100#F3E5FF
    White
    1.20
    Black
    17.46
  3. 200#E7CAFF
    White
    1.46
    Black
    14.28
  4. 300#D8A4FF
    White
    1.96
    Black
    10.67
  5. 400#C876FF
    White
    2.80
    Black
    7.49
  6. 500#B540F8
    White
    4.15
    Black
    5.05
  7. 600This color#9400D3
    White
    6.56
    Black
    3.19
  8. 700#7F00B5
    White
    8.17
    Black
    2.56
  9. 800#5D0087
    White
    11.56
    Black
    1.81
  10. 900#3E005B
    White
    15.48
    Black
    1.35
  11. 950#240037
    White
    18.58
    Black
    1.13

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

Gamut

How vivid #9400D3 can get

At its lightness and hue, sRGB reaches OKLCH chroma 0.261; #9400D3 uses 100% of it. Display P3, which many recent phones and laptops show, reaches 0.276 there: 6% more.

0.00.20.40.60.80.20.40.60.8 460480500520540560580600620
  • sRGB
  • Display P3
  • Rec. 2020
  • Dominant wavelength
OKLCH chroma
0.261
sRGB edge
0.261
Display P3 edge
0.276
Rec. 2020 edge
0.309
Dominant wavelength
Complementary 563 nm
Excitation purity
70%
Chromaticity
x 0.2460, y 0.1129
  • This color#9400D3
  • Most vivid in sRGB#9400D3
  • Most vivid in Display P3oklch(0.515 0.276 309.8)

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

Use the wider color where screens show it
.accent {
  color: #9400d3;
}
@media (color-gamut: p3) {
  .accent { color: color(display-p3 0.5381 0 0.8191); }
}

Mixing

Mixing #9400D3

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%#CA80E9
  • OKLab50%#C998EE
  • OKLCH50%#C998EE

Black #000000

  • sRGB50%#4A006A
  • OKLab50%#360051
  • OKLCH50%#360051

Its complement #4C7600

  • sRGB50%#703B6A
  • OKLab50%#725E82
  • OKLCH50%#00738C
In CSS
/* A gradient and a mix, worked out in OKLCH */
background: linear-gradient(in oklch, #9400d3, white);
color: color-mix(in oklch, #9400d3 50%, white);

In use

#9400D3 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:16.56:1 Passes
  • Link and body-size textText, 4.5:16.56:1 Passes
  • Large headingLarge text, 3:16.56:1 Passes
  • Icons, borders and focus ringsNon-text, 3:16.56:1 Passes

Dark page

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

For text on this page, the nearest shade that passes is #B540F8 4.50:1

Color vision

How #9400D3 looks with color blindness

Achromatopsia changes it most, ΔE2000 31.1; tritanopia changes it least, 18.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

    #0058D8 ΔE2000 21.4

    Distinct

    Reads as vivid blue

  • Deuteranopia

    No working green (medium-wavelength) cones

    #005FD0 ΔE2000 24.3

    Distinct

    Reads as vivid blue

  • Tritanopia

    No working blue (short-wavelength) cones

    #8A4C7B ΔE2000 18.5

    Distinct

    Reads as soft magenta

  • Achromatopsia

    No cone color vision; lightness only

    #5D5D5D ΔE2000 31.1

    Distinct

    Reads as dark gray

Pairing check

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

VisionThe pairΔE2000Verdict
Normal vision#9400D3 · #4C760083.4Stays distinct
Protanopia#0058D8 · #7C6C0061.6Stays distinct
Deuteranopia#005FD0 · #76691457.5Stays distinct
Tritanopia#8A4C7B · #4E706331.4Stays distinct
Achromatopsia#5D5D5D · #6A6A6A4.8Easily confused

Harmony

Color harmonies for #9400D3

Its complement is #4C7600, a soft green.

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

Open the Harmony Studio
  • Base#9400D3
  • Complement#4C7600

Complementary

Open in Harmony Studio
  • −30°#5838F6
  • Base#9400D3
  • +30°#B2008F
  • Base#9400D3
  • +120°#905A00
  • +240°#007773
  • Base#9400D3
  • +150°#766800
  • +210°#007B4F

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-darkviolet: #9400d3;
}

Tailwind config

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        darkviolet: '#9400d3',
      },
    },
  },
};

Tailwind v4 theme

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

@theme {
  --color-darkviolet: oklch(0.515 0.261 309.8);
}

Design token (W3C DTCG)

{
  "color": {
    "darkviolet": {
      "$type": "color",
      "$value": {
        "colorSpace": "srgb",
        "components": [0.5804, 0, 0.8275],
        "hex": "#9400d3"
      },
      "$description": "CSS named color darkviolet"
    }
  }
}

SwiftUI color

import SwiftUI

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

Jetpack Compose color

import androidx.compose.ui.graphics.Color

object Palette {
    val Darkviolet = Color(0xFF9400D3)
}

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 #9400D3 in the tools

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