CSS named color

Blue Violet #8A2BE2

The CSS keyword blueviolet is #8A2BE2. It is a vivid violet in the violet family. In OKLCH it sits at lightness 0.534, chroma 0.250 and hue 301.4°.

Relative luminance
0.1262
OKLCH L · C · h
0.534 · 0.250 · 301.4
Best text
White 5.95:1
Hue family
Violet

#8A2BE2 color codes

HEX
#8A2BE2
RGB
rgb(138, 43, 226)
HSL
hsl(271, 76%, 53%)
OKLCH
oklch(0.534 0.250 301.4)
OKLab
oklab(0.534 0.130 -0.214)
CIELAB (D65)
L* 42.19, a* 69.84, b* -74.76
XYZ (D65)
X 25.07, Y 12.62, Z 73.05
CMYK (naive)
cmyk(39%, 81%, 0%, 11%)

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 #8A2BE2 accessible?

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

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

    5.95:1

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

    3.52:1

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

    5.95:1

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

Nearest versions that pass 4.5:1

  • For text on white

    #8A2BE2 5.95:1

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

  • For text on black

    #9C44F7 4.58:1

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

Checking another pair? Use the Contrast Checker.

Studio

Adjust #8A2BE2 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 #8A2BE2

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

  1. 50#F7F3FF
    White
    1.09
    Black
    19.21
  2. 100#EFE6FF
    White
    1.20
    Black
    17.43
  3. 200#DFCDFF
    White
    1.46
    Black
    14.31
  4. 300#CBABFF
    White
    1.94
    Black
    10.80
  5. 400#B682FF
    White
    2.75
    Black
    7.62
  6. 500#A34FFF
    White
    4.10
    Black
    5.11
  7. 600This color#8A2BE2
    White
    5.95
    Black
    3.52
  8. 700#7402C5
    White
    8.21
    Black
    2.55
  9. 800#550093
    White
    11.61
    Black
    1.80
  10. 900#380064
    White
    15.53
    Black
    1.35
  11. 950#20003D
    White
    18.60
    Black
    1.12

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

Gamut

How vivid #8A2BE2 can get

At its lightness and hue, sRGB reaches OKLCH chroma 0.283; #8A2BE2 uses 88% of it. Display P3, which many recent phones and laptops show, reaches 0.295 there: 4% more.

0.00.20.40.60.80.20.40.60.8 460480500520540560580600620
  • sRGB
  • Display P3
  • Rec. 2020
  • Dominant wavelength
OKLCH chroma
0.250
sRGB edge
0.283
Display P3 edge
0.295
Rec. 2020 edge
0.326
Dominant wavelength
Complementary 566 nm
Excitation purity
66%
Chromaticity
x 0.2264, y 0.1140
  • This color#8A2BE2
  • Most vivid in sRGB#8F00F1
  • Most vivid in Display P3oklch(0.534 0.295 301.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: #8a2be2;
}
@media (color-gamut: p3) {
  .accent { color: color(display-p3 0.5153 0 0.9287); }
}

Mixing

Mixing #8A2BE2

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%#C595F1
  • OKLab50%#C1A0F6
  • OKLCH50%#C1A0F6

Black #000000

  • sRGB50%#451671
  • OKLab50%#320A57
  • OKLCH50%#320A57

Its complement #627700

  • sRGB50%#765171
  • OKLab50%#73658B
  • OKLCH50%#C22C17
In CSS
/* A gradient and a mix, worked out in OKLCH */
background: linear-gradient(in oklch, #8a2be2, white);
color: color-mix(in oklch, #8a2be2 50%, white);

In use

#8A2BE2 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.95:1 Passes
  • Link and body-size textText, 4.5:15.95:1 Passes
  • Large headingLarge text, 3:15.95:1 Passes
  • Icons, borders and focus ringsNon-text, 3:15.95:1 Passes

Dark page

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

For text on this page, the nearest shade that passes is #A34EFF 4.54:1

Color vision

How #8A2BE2 looks with color blindness

Achromatopsia changes it most, ΔE2000 31.0; tritanopia changes it least, 19.4.

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

    #0063E7 ΔE2000 19.8

    Distinct

    Reads as vivid blue

  • Deuteranopia

    No working green (medium-wavelength) cones

    #0063DF ΔE2000 20.5

    Distinct

    Reads as vivid blue

  • Tritanopia

    No working blue (short-wavelength) cones

    #765F89 ΔE2000 19.4

    Distinct

    Reads as muted violet

  • Achromatopsia

    No cone color vision; lightness only

    #646464 ΔE2000 31.0

    Distinct

    Reads as gray

Pairing check

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

VisionThe pairΔE2000Verdict
Normal vision#8A2BE2 · #62770078.6Stays distinct
Protanopia#0063E7 · #7F6F0061.8Stays distinct
Deuteranopia#0063DF · #7D6F1359.7Stays distinct
Tritanopia#765F89 · #68706425.7Stays distinct
Achromatopsia#646464 · #6F6F6F4.2Easily confused

Harmony

Color harmonies for #8A2BE2

Its complement is #627700, a soft yellow.

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

Open the Harmony Studio
  • Base#8A2BE2
  • Complement#627700

Complementary

Open in Harmony Studio
  • −30°#424EFA
  • Base#8A2BE2
  • +30°#B400AA
  • Base#8A2BE2
  • +120°#9F5900
  • +240°#007F70
  • Base#8A2BE2
  • +150°#846A00
  • +210°#00833F

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-blueviolet: #8a2be2;
}

Tailwind config

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        blueviolet: '#8a2be2',
      },
    },
  },
};

Tailwind v4 theme

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

@theme {
  --color-blueviolet: oklch(0.534 0.250 301.4);
}

Design token (W3C DTCG)

{
  "color": {
    "blueviolet": {
      "$type": "color",
      "$value": {
        "colorSpace": "srgb",
        "components": [0.5412, 0.1686, 0.8863],
        "hex": "#8a2be2"
      },
      "$description": "CSS named color blueviolet"
    }
  }
}

SwiftUI color

import SwiftUI

enum Palette {
    static let blueviolet = Color(.sRGB, red: 0.541, green: 0.169, blue: 0.886, opacity: 1)
}

Jetpack Compose color

import androidx.compose.ui.graphics.Color

object Palette {
    val Blueviolet = Color(0xFF8A2BE2)
}

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 #8A2BE2 in the tools

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