Skip to content

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.

BlueViolet#8A2BE2

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

Color codes for BlueViolet
CSS keywordblueviolet
HEX#8A2BE2
RGBrgb(138, 43, 226)
HSLhsl(271, 76%, 53%)
HWBhwb(271 17% 11%)
OKLCHoklch(53.4% 0.25 301.4)
CMYK (naive, no ICC profile)cmyk(39%, 81%, 0%, 11%)
Decimal9,055,202
Hue familyPurples 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.

Contrast and accessibility
PairRatioAAAA largeAAAAAA largeAPCA Lc
Black text on blueviolet3.52:1FailPassFailFail25.6
White text on blueviolet5.95:1PassPassFailPass−83.7
Blueviolet text on white5.95:1PassPassFailPass78.4
Blueviolet text on black3.52:1FailPassFailFail−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)

  1. 5%
    #9036e3
  2. 15%
    #9c4be6
  3. 25%
    #a760e9
  4. 35%
    #b375ec
  5. 45%
    #bf8aef
  6. 55%
    #caa0f2
  7. 65%
    #d6b5f5
  8. 75%
    #e2caf8
  9. 85%
    #eddffb
  10. 95%
    #f9f4fe

Shades (mixed with black)

  1. 5%
    #8329d7
  2. 15%
    #7525c0
  3. 25%
    #6820aa
  4. 35%
    #5a1c93
  5. 45%
    #4c187c
  6. 55%
    #3e1366
  7. 65%
    #300f4f
  8. 75%
    #230b39
  9. 85%
    #150622
  10. 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.

Color harmonies
HarmonyRotationColor
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

Nearest CSS named colors
ColorHEXΔE OK
darkviolet#9400d34.3
darkorchid#9932cc4.9
slateblue#6a5acd9.8

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
purple-700#8200db4.1
purple-600#9810fa4.5
violet-600#7f22fe5.0

Code snippets

CSS
.element {
  color: blueviolet;
  background-color: #8a2be2;
  border-color: rgb(138 43 226);
  outline-color: oklch(53.4% 0.25 301.4);
}
Tailwind CSS
<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 */
SwiftUI
import SwiftUI

extension Color {
  static let blueviolet = Color(red: 0.541, green: 0.169, blue: 0.886)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

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

const blueviolet = Color(0xFF8A2BE2);
Android XML
<!-- 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.