CSS named color

Medium Purple #9370DB

The CSS keyword mediumpurple is #9370DB. It is a soft violet in the violet family. In OKLCH it sits at lightness 0.627, chroma 0.158 and hue 296.7°.

Relative luminance
0.2291
OKLCH L · C · h
0.627 · 0.158 · 296.7
Best text
Black 5.58:1
Hue family
Violet

#9370DB color codes

HEX
#9370DB
RGB
rgb(147, 112, 219)
HSL
hsl(260, 60%, 65%)
OKLCH
oklch(0.627 0.158 296.7)
OKLab
oklab(0.627 0.071 -0.141)
CIELAB (D65)
L* 54.97, a* 36.80, b* -50.09
XYZ (D65)
X 30.61, Y 22.91, Z 69.81
CMYK (naive)
cmyk(33%, 49%, 0%, 14%)

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 #9370DB accessible?

Black text on it reaches 5.58:1, passing AA. White text manages only 3.76: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

    5.58:1

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

    3.76:1

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

    5.58:1

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

    3.76:1

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

Nearest versions that pass 4.5:1

  • For text on white

    #8662CC 4.53:1

    Darkening its OKLCH lightness from 0.63 to 0.58 reaches 4.53:1 on white, keeping the hue.

  • For text on black

    #9370DB 5.58:1

    It already reaches 5.58:1 on black, so no change is needed.

Checking another pair? Use the Contrast Checker.

Studio

Adjust #9370DB 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 #9370DB

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

  1. 50#F6F3FF
    White
    1.09
    Black
    19.18
  2. 100#EDE7FF
    White
    1.20
    Black
    17.47
  3. 200#DBCFFF
    White
    1.46
    Black
    14.38
  4. 300#C5AEFF
    White
    1.93
    Black
    10.87
  5. 400#AC8AF6
    White
    2.72
    Black
    7.72
  6. 500This color#9370DB
    White
    3.76
    Black
    5.58
  7. 600#7956BE
    White
    5.40
    Black
    3.88
  8. 700#633FA2
    White
    7.59
    Black
    2.76
  9. 800#4A2681
    White
    11.13
    Black
    1.88
  10. 900#320D61
    White
    15.37
    Black
    1.36
  11. 950#1E0040
    White
    18.59
    Black
    1.12

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

Gamut

How vivid #9370DB can get

At its lightness and hue, sRGB reaches OKLCH chroma 0.230; #9370DB uses 69% of it. Display P3, which many recent phones and laptops show, reaches 0.249 there: 8% more.

0.00.20.40.60.80.20.40.60.8 460480500520540560580600620
  • sRGB
  • Display P3
  • Rec. 2020
  • Dominant wavelength
OKLCH chroma
0.158
sRGB edge
0.230
Display P3 edge
0.249
Rec. 2020 edge
0.252
Dominant wavelength
432 nm
Excitation purity
45%
Chromaticity
x 0.2482, y 0.1857
  • This color#9370DB
  • Most vivid in sRGB#9A5CFF
  • Most vivid in Display P3oklch(0.627 0.249 296.7)

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

Use the wider color where screens show it
.accent {
  color: #9370db;
}
@media (color-gamut: p3) {
  .accent { color: color(display-p3 0.5749 0.348 1); }
}

Mixing

Mixing #9370DB

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%#C9B8ED
  • OKLab50%#C7B8F0
  • OKLCH50%#C7B8F0

Black #000000

  • sRGB50%#4A386E
  • OKLab50%#362754
  • OKLCH50%#362754

Its complement #839200

  • sRGB50%#8B816E
  • OKLab50%#88878C
  • OKLCH50%#009AA9
In CSS
/* A gradient and a mix, worked out in OKLCH */
background: linear-gradient(in oklch, #9370db, white);
color: color-mix(in oklch, #9370db 50%, white);

In use

#9370DB 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:15.58:1 Passes
  • Link and body-size textText, 4.5:13.76:1 Fails
  • Large headingLarge text, 3:13.76:1 Passes
  • Icons, borders and focus ringsNon-text, 3:13.76:1 Passes

For text on this page, the nearest shade that passes is #8662CC 4.53:1

Dark page

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

Color vision

How #9370DB looks with color blindness

Achromatopsia changes it most, ΔE2000 26.1; deuteranopia changes it least, 16.3.

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

    #4B84DF ΔE2000 17.5

    Distinct

    Reads as soft blue

  • Deuteranopia

    No working green (medium-wavelength) cones

    #5282D8 ΔE2000 16.3

    Distinct

    Reads as soft blue

  • Tritanopia

    No working blue (short-wavelength) cones

    #83849B ΔE2000 16.7

    Distinct

    Reads as grayish blue

  • Achromatopsia

    No cone color vision; lightness only

    #848484 ΔE2000 26.1

    Distinct

    Reads as gray

Pairing check

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

VisionThe pairΔE2000Verdict
Normal vision#9370DB · #83920069.7Stays distinct
Protanopia#4B84DF · #9D890056.6Stays distinct
Deuteranopia#5282D8 · #9C8B1955.3Stays distinct
Tritanopia#83849B · #8C897B18.9Stays distinct
Achromatopsia#848484 · #8A8A8A2.2Easily confused

Harmony

Color harmonies for #9370DB

Its complement is #839200, a soft yellow.

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

Open the Harmony Studio
  • Base#9370DB
  • Complement#839200

Complementary

Open in Harmony Studio
  • −30°#5C82E7
  • Base#9370DB
  • +30°#B861BA
  • Base#9370DB
  • +120°#CB6B00
  • +240°#009F86
  • Base#9370DB
  • +150°#AA8200
  • +210°#36A14A

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-mediumpurple: #9370db;
}

Tailwind config

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        mediumpurple: '#9370db',
      },
    },
  },
};

Tailwind v4 theme

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

@theme {
  --color-mediumpurple: oklch(0.627 0.158 296.7);
}

Design token (W3C DTCG)

{
  "color": {
    "mediumpurple": {
      "$type": "color",
      "$value": {
        "colorSpace": "srgb",
        "components": [0.5765, 0.4392, 0.8588],
        "hex": "#9370db"
      },
      "$description": "CSS named color mediumpurple"
    }
  }
}

SwiftUI color

import SwiftUI

enum Palette {
    static let mediumpurple = Color(.sRGB, red: 0.576, green: 0.439, blue: 0.859, opacity: 1)
}

Jetpack Compose color

import androidx.compose.ui.graphics.Color

object Palette {
    val Mediumpurple = Color(0xFF9370DB)
}

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 #9370DB in the tools

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