Skip to content

CSS named color

DarkViolet #9400D3

DarkViolet (CSS keyword darkviolet) has the hex code #9400D3 and the RGB value rgb(148, 0, 211): a medium-dark, vivid violet.

DarkViolet#9400D3

A saturated purple with no green component (#9400d3). It is much deeper and more vivid than CSS violet, which is a pale pinkish lilac.

Color codes for DarkViolet

Color codes for DarkViolet
CSS keyworddarkviolet
HEX#9400D3
RGBrgb(148, 0, 211)
HSLhsl(282, 100%, 41%)
HWBhwb(282 0% 17%)
OKLCHoklch(51.5% 0.261 309.8)
CMYK (naive, no ICC profile)cmyk(30%, 100%, 0%, 17%)
Decimal9,699,539
Hue familyPurples and violets

Contrast and accessibility

On darkviolet, white text has a contrast ratio of 6.56:1 and passes AA for normal text; black text reaches 3.19: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 darkviolet3.19:1FailPassFailFail24.0
White text on darkviolet6.56:1PassPassFailPass−85.2
Darkviolet text on white6.56:1PassPassFailPass80.0
Darkviolet text on black3.19:1FailPassFailFail−21.8

Tints and shades

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

Tints (mixed with white)

  1. 5%
    #990dd5
  2. 15%
    #a426da
  3. 25%
    #af40de
  4. 35%
    #b959e2
  5. 45%
    #c473e7
  6. 55%
    #cf8ceb
  7. 65%
    #daa6f0
  8. 75%
    #e4bff4
  9. 85%
    #efd9f8
  10. 95%
    #faf2fd

Shades (mixed with black)

  1. 5%
    #8d00c8
  2. 15%
    #7e00b3
  3. 25%
    #6f009e
  4. 35%
    #600089
  5. 45%
    #510074
  6. 55%
    #43005f
  7. 65%
    #34004a
  8. 75%
    #250035
  9. 85%
    #160020
  10. 95%
    #07000b

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, darkviolet's complementary color is #477800 (close to green), its analogous colors are #5838F6 and #B70092, and its triadic partners are #965600 and #007A75. For text on top, white gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#477800
Analogous−30°, +30°#5838f6#b70092
Triadic+120°, +240°#965600#007a75
Split-complementary+150°, +210°#796700#007f49

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?

DarkViolet is a cool color: its hue is 282° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.

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
darkorchid#9932cc4.3
blueviolet#8a2be24.3
darkmagenta#8b008b11.5

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
purple-700#8200db4.1
purple-600#9810fa6.2
fuchsia-700#a800b76.4

Code snippets

CSS
.element {
  color: darkviolet;
  background-color: #9400d3;
  border-color: rgb(148 0 211);
  outline-color: oklch(51.5% 0.261 309.8);
}
Tailwind CSS
<div class="bg-[#9400d3] text-white">...</div>

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

extension Color {
  static let darkviolet = Color(red: 0.580, green: 0.000, blue: 0.827)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

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

const darkviolet = Color(0xFF9400D3);
Android XML
<!-- res/values/colors.xml -->
<color name="darkviolet">#9400D3</color>

Frequently asked questions

What is the hex code for darkviolet?
The hex code for darkviolet is #9400D3. The same color is rgb(148, 0, 211), hsl(282, 100%, 41%) and oklch(51.5% 0.261 309.8), and in CSS you can also write the keyword darkviolet directly.
Is darkviolet a warm or cool color?
DarkViolet is a cool color: its hue is 282° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
What colors go with darkviolet?
Rotating the hue in OKLCH while keeping lightness and chroma, darkviolet's complementary color is #477800 (close to green), its analogous colors are #5838F6 and #B70092, and its triadic partners are #965600 and #007A75. For text on top, white gives the higher contrast.
Can you use white text on darkviolet?
White text on darkviolet has a contrast ratio of 6.56:1, which passes AA for normal text but not AAA under WCAG 2.2. Black text reaches 3.19:1 and passes AA only for large text (24 px, or 18.66 px bold, and up). In APCA terms that is Lc −85.2 for white and Lc 24.0 for black.
What is the RGB value of darkviolet?
DarkViolet is rgb(148, 0, 211): red 148, green 0 and blue 211 on the 0 to 255 scale, or 58.0%, 0.0% and 82.7%. As a decimal integer it is 9699539.

Last reviewed by Arielton Oberek.