CSS named color
BlueViolet #8A2BE2
BlueViolet (CSS keyword blueviolet) has the hex code #8A2BE2 and the RGB value rgb(138, 43, 226): a medium-dark, vivid violet.
A saturated purple that leans toward blue, about halfway between darkorchid and slateblue. It is one of the few named colors with high chroma in the violet range.
Color codes for BlueViolet
| CSS keyword | blueviolet |
|---|---|
| HEX | #8A2BE2 |
| RGB | rgb(138, 43, 226) |
| HSL | hsl(271, 76%, 53%) |
| HWB | hwb(271 17% 11%) |
| OKLCH | oklch(53.4% 0.25 301.4) |
| CMYK (naive, no ICC profile) | cmyk(39%, 81%, 0%, 11%) |
| Decimal | 9,055,202 |
| Hue family | Purples and violets |
Contrast and accessibility
On blueviolet, white text has a contrast ratio of 5.95:1 and passes AA for normal text; black text reaches 3.52: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 blueviolet | 3.52:1 | Fail | Pass | Fail | Fail | 25.6 |
| White text on blueviolet | 5.95:1 | Pass | Pass | Fail | Pass | −83.7 |
| Blueviolet text on white | 5.95:1 | Pass | Pass | Fail | Pass | 78.4 |
| Blueviolet text on black | 3.52:1 | Fail | Pass | Fail | Fail | −23.3 |
Tints and shades
Each step mixes blueviolet with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, blueviolet, white 25%) in CSS.
Tints (mixed with white)
- 5%
#9036e3 - 15%
#9c4be6 - 25%
#a760e9 - 35%
#b375ec - 45%
#bf8aef - 55%
#caa0f2 - 65%
#d6b5f5 - 75%
#e2caf8 - 85%
#eddffb - 95%
#f9f4fe
Shades (mixed with black)
- 5%
#8329d7 - 15%
#7525c0 - 25%
#6820aa - 35%
#5a1c93 - 45%
#4c187c - 55%
#3e1366 - 65%
#300f4f - 75%
#230b39 - 85%
#150622 - 95%
#07020b
Color harmonies
Rotating the hue in OKLCH while keeping lightness and chroma, blueviolet's complementary color is #607900 (close to olive), its analogous colors are #424EFA and #B600AC, and its triadic partners are #A65400 and #008271. For text on top, white gives the higher contrast.
| Harmony | Rotation | Color |
|---|---|---|
| Complementary | +180° | #607900 |
| Analogous | −30°, +30° | #424efa#b600ac |
| Triadic | +120°, +240° | #a65400#008271 |
| Split-complementary | +150°, +210° | #886800#008732 |
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?
BlueViolet is a cool color: its hue is 271° 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 |
|---|---|---|
| darkviolet | #9400d3 | 4.3 |
| darkorchid | #9932cc | 4.9 |
| slateblue | #6a5acd | 9.8 |
Nearest Tailwind v4 colors
| Color | HEX | ΔE OK |
|---|---|---|
| purple-700 | #8200db | 4.1 |
| purple-600 | #9810fa | 4.5 |
| violet-600 | #7f22fe | 5.0 |
Code snippets
.element {
color: blueviolet;
background-color: #8a2be2;
border-color: rgb(138 43 226);
outline-color: oklch(53.4% 0.25 301.4);
}<div class="bg-[#8a2be2] text-white">...</div>
/* or register it once in your CSS (Tailwind v4) */
@theme {
--color-blueviolet: #8a2be2;
}
/* then use bg-blueviolet, text-blueviolet, border-blueviolet */import SwiftUI
extension Color {
static let blueviolet = Color(red: 0.541, green: 0.169, blue: 0.886)
}import androidx.compose.ui.graphics.Color
val Blueviolet = Color(0xFF8A2BE2)import 'package:flutter/material.dart';
const blueviolet = Color(0xFF8A2BE2);<!-- res/values/colors.xml -->
<color name="blueviolet">#8A2BE2</color>Frequently asked questions
- What is the hex code for blueviolet?
- The hex code for blueviolet is #8A2BE2. The same color is rgb(138, 43, 226), hsl(271, 76%, 53%) and oklch(53.4% 0.25 301.4), and in CSS you can also write the keyword blueviolet directly.
- Is blueviolet a warm or cool color?
- BlueViolet is a cool color: its hue is 271° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
- What colors go with blueviolet?
- Rotating the hue in OKLCH while keeping lightness and chroma, blueviolet's complementary color is #607900 (close to olive), its analogous colors are #424EFA and #B600AC, and its triadic partners are #A65400 and #008271. For text on top, white gives the higher contrast.
- Can you use white text on blueviolet?
- White text on blueviolet has a contrast ratio of 5.95:1, which passes AA for normal text but not AAA under WCAG 2.2. Black text reaches 3.52:1 and passes AA only for large text (24 px, or 18.66 px bold, and up). In APCA terms that is Lc −83.7 for white and Lc 25.6 for black.
- What is the RGB value of blueviolet?
- BlueViolet is rgb(138, 43, 226): red 138, green 43 and blue 226 on the 0 to 255 scale, or 54.1%, 16.9% and 88.6%. As a decimal integer it is 9055202.
Last reviewed by Arielton Oberek.