Basic HTML and CSS color
Purple #800080
Purple (CSS keyword purple) has the hex code #800080 and the RGB value rgb(128, 0, 128): a dark, vivid purple.
Purple (#800080) is one of the 16 original HTML colors, half-intensity red and blue. In X11, purple was a brighter violet (#a020f0), one of the four names where CSS and X11 disagree.
Color codes for Purple
| CSS keyword | purple |
|---|---|
| HEX | #800080 |
| RGB | rgb(128, 0, 128) |
| HSL | hsl(300, 100%, 25%) |
| HWB | hwb(300 0% 50%) |
| OKLCH | oklch(42.1% 0.193 328.4) |
| CMYK (naive, no ICC profile) | cmyk(0%, 100%, 0%, 50%) |
| Decimal | 8,388,736 |
| Hue family | Purples and violets |
Contrast and accessibility
On purple, white text has a contrast ratio of 9.41:1 and passes AAA at any text size; black text reaches 2.22: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 purple | 2.22:1 | Fail | Fail | Fail | Fail | 14.4 |
| White text on purple | 9.41:1 | Pass | Pass | Pass | Pass | −94.1 |
| Purple text on white | 9.41:1 | Pass | Pass | Pass | Pass | 89.6 |
| Purple text on black | 2.22:1 | Fail | Fail | Fail | Fail | −12.7 |
Tints and shades
Each step mixes purple with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, purple, white 25%) in CSS.
Tints (mixed with white)
- 5%
#860d86 - 15%
#932693 - 25%
#a040a0 - 35%
#ac59ac - 45%
#b973b9 - 55%
#c68cc6 - 65%
#d3a6d3 - 75%
#dfbfdf - 85%
#ecd9ec - 95%
#f9f2f9
Shades (mixed with black)
- 5%
#7a007a - 15%
#6d006d - 25%
#600060 - 35%
#530053 - 45%
#460046 - 55%
#3a003a - 65%
#2d002d - 75%
#200020 - 85%
#130013 - 95%
#060006
Color harmonies
Rotating the hue in OKLCH while keeping lightness and chroma, purple's complementary color is #00620F (close to darkgreen), its analogous colors are #5E21A6 and #94004C, and its triadic partners are #654800 and #005A68. For text on top, white gives the higher contrast.
| Harmony | Rotation | Color |
|---|---|---|
| Complementary | +180° | #00620f |
| Analogous | −30°, +30° | #5e21a6#94004c |
| Triadic | +120°, +240° | #654800#005a68 |
| Split-complementary | +150°, +210° | #485500#005e4e |
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?
Purple sits on the boundary: its hue of 300° on the HSL wheel is a magenta, which reads warm next to blues and cool next to reds and oranges.
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 |
|---|---|---|
| darkmagenta | #8b008b | 2.8 |
| rebeccapurple | #663399 | 8.5 |
| indigo | #4b0082 | 12.0 |
Nearest Tailwind v4 colors
| Color | HEX | ΔE OK |
|---|---|---|
| fuchsia-900 | #721378 | 3.2 |
| fuchsia-800 | #8a0194 | 3.8 |
| purple-900 | #59168b | 8.7 |
Code snippets
.element {
color: purple;
background-color: #800080;
border-color: rgb(128 0 128);
outline-color: oklch(42.1% 0.193 328.4);
}<div class="bg-[#800080] text-white">...</div>
/* or register it once in your CSS (Tailwind v4) */
@theme {
--color-purple: #800080;
}
/* then use bg-purple, text-purple, border-purple */import SwiftUI
extension Color {
static let purple = Color(red: 0.502, green: 0.000, blue: 0.502)
}import androidx.compose.ui.graphics.Color
val Purple = Color(0xFF800080)import 'package:flutter/material.dart';
const purple = Color(0xFF800080);<!-- res/values/colors.xml -->
<color name="purple">#800080</color>Frequently asked questions
- What is the hex code for purple?
- The hex code for purple is #800080. The same color is rgb(128, 0, 128), hsl(300, 100%, 25%) and oklch(42.1% 0.193 328.4), and in CSS you can also write the keyword purple directly.
- Is purple a warm or cool color?
- Purple sits on the boundary: its hue of 300° on the HSL wheel is a magenta, which reads warm next to blues and cool next to reds and oranges.
- What colors go with purple?
- Rotating the hue in OKLCH while keeping lightness and chroma, purple's complementary color is #00620F (close to darkgreen), its analogous colors are #5E21A6 and #94004C, and its triadic partners are #654800 and #005A68. For text on top, white gives the higher contrast.
- Can you use white text on purple?
- White text on purple has a contrast ratio of 9.41:1, which passes both AA and AAA under WCAG 2.2. Black text reaches 2.22:1 and fails AA even for large text. In APCA terms that is Lc −94.1 for white and Lc 14.4 for black.
- What is the RGB value of purple?
- Purple is rgb(128, 0, 128): red 128, green 0 and blue 128 on the 0 to 255 scale, or 50.2%, 0.0% and 50.2%. As a decimal integer it is 8388736.
Last reviewed by Arielton Oberek.