Skip to content

#331f56

a deep, vivid violet · cool · closest name: Midnight Blue

RGB
51, 31, 86
HSL
262°, 47%, 23%
CMYK
41, 64, 0, 66
Luminance
0.0236

At a glance

Every number on this page in one read: what #331f56 is made of, how bright it looks, and which way it leans.

Hex
#331f56
Hue
262°
violet
Saturation
47%
vivid
Lightness
23%
deep
Brightness
34%
HSV value
Perceived
18%
weighted brightness
Luminance
0.0236
WCAG relative
Temperature
Cool
71/100 cool
Color family
Violet
Tone
Vivid
Best ink
White
14.27:1
Closest name
Midnight Blue
ΔE2000 8
Where it sits
Hue262° of 360°
Saturation47%
Lightness23%
Temperature
Warm ← → Cool71% cool

Reads cool. Warm and cool siblings keep the same lightness, so you can swap one in without redoing your contrast maths.

Every format

HEX#331f56
RGBrgb(51, 31, 86)
HSLhsl(262, 47%, 23%)
CMYKcmyk(41%, 64%, 0%, 66%)
LABlab(17.3 23.6 -30.0)
LCHlch(17.3 38.2 308.1)
OKLCHoklch(0.297 0.096 296.9)
Decimal3350358
Display P3color(display-p3 0.200 0.122 0.337)

Copy-ready code

/* CSS */
color: #331f56;
background-color: #331f56;
/* Tailwind (arbitrary) */
class="text-[#331f56] bg-[#331f56]"
/* SCSS */
$brand: #331f56;
/* SwiftUI */
Color(red: 0.200, green: 0.122, blue: 0.337)
/* Android */
Color.parseColor("#331f56")
/* Flutter */
Color(0xFF331F56)
/* Python / OpenCV (BGR) */
(86, 31, 51)

Best text color

Only one of black and white can be right. This is the one, with the number that proves it.

Readable at a glance#ffffff on #331f56 · 14.27:1
Use #ffffffAAA at every size.
Aa
White text · 14.27:1 · recommended
AA pass · AA large pass · AAA pass
Aa
Black text · 1.47:1
AA fail · AA large fail · AAA fail
Reading the other direction: #331f56 as text scores 14.27:1 on white and 1.47:1 on black.

Accessibility — WCAG contrast

Aa
#331f56 on white: 14.27:1
AA ✓ pass · AA-large · AAA
Aa
#331f56 on black: 1.47:1
AA ✗ fail · AA-large · AAA
true color
protanopia · #012B58
deuteranopia · #092A55
tritanopia · #2B2B37

Color scale — 50 to 950

A Tailwind-shaped ramp built around this exact hex. #331f56 is pinned to step 900; the rest hold its hue and let saturation ease off at the extremes so the pale end never turns neon.

#F7F5FA
#EEEAF5
#DAD0EC
#C0ADE1
#A083D2
#805AC4
#6B41B4
#593696
#472B78
#331f56
#221637
Base = 900Lightest = 50 · #F7F5FADarkest = 950 · #221637
:root {
  --brand-50: #F7F5FA;
  --brand-100: #EEEAF5;
  --brand-200: #DAD0EC;
  --brand-300: #C0ADE1;
  --brand-400: #A083D2;
  --brand-500: #805AC4;
  --brand-600: #6B41B4;
  --brand-700: #593696;
  --brand-800: #472B78;
  --brand-900: #331f56;
  --brand-950: #221637;
  --brand: #331f56;
  --brand-ink: #ffffff;
}

Colors that work with #331f56

Not a palette — a role sheet. Each swatch answers one question you will hit while building the component.

Text on it#ffffff
White wins here
Surface#F7F4FA
Tinted page background
Border#D1C3E9
Hairlines and dividers
Muted text#684B9B
Captions on the surface
Accent#51581D
Second voice, not a rival
Dark variant#38225E
Hover, pressed, headers
Light variant#F1ECF8
Selected rows, tints
Dark surface#1A1424
Dark-mode background
Light mode
Everything in its place

Surface, border, heading and body all derive from this one hue, so the screen stays coherent without a second palette.

Primary actionSecondaryBadge
Dark mode
Same hue, inverted

Lightness flips, hue holds. The accent stays the anchor in both themes.

Primary actionSecondaryAccent

How to use #331f56

Derived from its contrast, chroma and lightness — not from taste.

Works well for
  • Body text and links on white
  • Primary buttons and calls to action
  • Focus rings, active and selected states
  • Headers, footers and dark-mode surfaces
  • Brand accents, badges and data highlights
Use with care
  • Text on black or near-black surfaces
  • Full-page backgrounds — tiring over long sessions
  • Black text placed on it
  • Pairing with a same-lightness hue — edges vibrate

Similar colors

One move away from this hex in each direction. Every swatch is its own page.

Color relationships

The wheel positions with their names attached, so you can grab the one you actually need.

Complementary#42561F
Analogous left#1F2656
Analogous right#4E1F56
Split-complement 1#564E1F
Split-complement 2#26561F
Triadic 1#56331F
Triadic 2#1F5633
Tetradic#561F26

RGB percentages

Red20.0%
Green12.2%
Blue33.7%

CMYK percentages

Cyan40.7%
Magenta64.0%
Yellow0.0%
Key (black)66.3%

Color previews

#331f56 text on a black background

contrast 1.47:1

Card sample

#331f56 text on a white background

contrast 14.27:1

Card sample

CSS3 live lab

Text font color

The quick brown fox

color: #331f56;
Background color
Panel with #331f56 background
background-color: #331f56;
Text shadow — hex

Glowing headline

text-shadow: 2px 2px 8px #331f56;
Text shadow — RGB

Soft neon halo

text-shadow: 0 0 14px rgba(51, 31, 86, 0.45);
Div box shadow
Elevated card
box-shadow: 0 12px 32px -8px rgba(51, 31, 86, 0.45);
Border & gradient
Gradient panel
border: 3px solid #331f56;
background: linear-gradient(135deg, #331f56, #561F54);

Monochromatic scale

Palettes built from #331f56

Shades — darker

Tints — lighter

Color harmonies

Nearest named colors

Ranked with CIEDE2000 across all 139 CSS keywords. Under ΔE 2 the eye stops telling them apart; over ΔE 10 they are plainly different colors.

#331f56 in the real world

Where a color in this family tends to land, and the interface roles it is usually asked to play.

Industries
Creative toolsFintechBeautyLuxury
Common UI roles
ButtonsLinksFocus statesCharts
Print note

Converts to four-color process without much drama. Proof it anyway.

#331f56, answered

What color is #331f56?

#331f56 is a deep vivid violet, closest to Midnight Blue (ΔE2000 8). It sits at 262° on the hue wheel with 47% saturation and 23% lightness, which reads as cool.

What is the RGB value of #331f56?

rgb(51, 31, 86) — 51 red, 31 green and 86 blue out of 255, or 20% / 12.2% / 33.7% by channel.

Is #331f56 a light or a dark color?

It is a dark color. Relative luminance is 0.0236 and perceived brightness is 18%, so white text on it reaches 14.27:1.

Should I use black or white text on #331f56?

White. It scores 14.27:1 against #331f56, versus 1.47:1 for black — AAA at any size.

What is the complementary color of #331f56?

#42561F sits directly opposite on the wheel. Softer options are the split-complements #564E1F and #26561F, which give the same contrast with far less vibration.

What colors go well with #331f56?

For interface work: #F7F4FA as the surface, #D1C3E9 for borders, #684B9B for secondary text, #51581D as an accent and #38225E for hover and pressed states. For a palette, the analogous pair #1F2656 and #4E1F56 stays calm, while #42561F is the loudest partner.

What is #331f56 in CMYK for printing?

cmyk(41%, 64%, 0%, 66%). This is a screen-to-ink approximation — ask your printer for a proof before committing to a run.

Is #331f56 warm or cool?

Cool — it scores 71 on a scale where 0 is the warmest orange and 100 the coolest azure. Nudged warmer it becomes #471F56; nudged cooler, #1E1E57.

Work with #331f56 in the Color Lab