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.
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
| CSS keyword | darkviolet |
|---|---|
| HEX | #9400D3 |
| RGB | rgb(148, 0, 211) |
| HSL | hsl(282, 100%, 41%) |
| HWB | hwb(282 0% 17%) |
| OKLCH | oklch(51.5% 0.261 309.8) |
| CMYK (naive, no ICC profile) | cmyk(30%, 100%, 0%, 17%) |
| Decimal | 9,699,539 |
| Hue family | Purples 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.
| Pair | Ratio | AA | AA large | AAA | AAA large | APCA Lc |
|---|---|---|---|---|---|---|
| Black text on darkviolet | 3.19:1 | Fail | Pass | Fail | Fail | 24.0 |
| White text on darkviolet | 6.56:1 | Pass | Pass | Fail | Pass | −85.2 |
| Darkviolet text on white | 6.56:1 | Pass | Pass | Fail | Pass | 80.0 |
| Darkviolet text on black | 3.19:1 | Fail | Pass | Fail | Fail | −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)
- 5%
#990dd5 - 15%
#a426da - 25%
#af40de - 35%
#b959e2 - 45%
#c473e7 - 55%
#cf8ceb - 65%
#daa6f0 - 75%
#e4bff4 - 85%
#efd9f8 - 95%
#faf2fd
Shades (mixed with black)
- 5%
#8d00c8 - 15%
#7e00b3 - 25%
#6f009e - 35%
#600089 - 45%
#510074 - 55%
#43005f - 65%
#34004a - 75%
#250035 - 85%
#160020 - 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.
| Harmony | Rotation | Color |
|---|---|---|
| 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
| Color | HEX | ΔE OK |
|---|---|---|
| darkorchid | #9932cc | 4.3 |
| blueviolet | #8a2be2 | 4.3 |
| darkmagenta | #8b008b | 11.5 |
Nearest Tailwind v4 colors
| Color | HEX | ΔE OK |
|---|---|---|
| purple-700 | #8200db | 4.1 |
| purple-600 | #9810fa | 6.2 |
| fuchsia-700 | #a800b7 | 6.4 |
Code snippets
.element {
color: darkviolet;
background-color: #9400d3;
border-color: rgb(148 0 211);
outline-color: oklch(51.5% 0.261 309.8);
}<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 */import SwiftUI
extension Color {
static let darkviolet = Color(red: 0.580, green: 0.000, blue: 0.827)
}import androidx.compose.ui.graphics.Color
val Darkviolet = Color(0xFF9400D3)import 'package:flutter/material.dart';
const darkviolet = Color(0xFF9400D3);<!-- 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.