Skip to content

#331ba4

a dark, vivid blue · cool · closest name: Medium Blue

RGB
51, 27, 164
HSL
251°, 72%, 38%
CMYK
69, 84, 0, 36
Luminance
0.0417

At a glance

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

Hex
#331ba4
Hue
251°
blue
Saturation
72%
vivid
Lightness
38%
dark
Brightness
64%
HSV value
Perceived
26%
weighted brightness
Luminance
0.0417
WCAG relative
Temperature
Cool
78/100 cool
Color family
Blue
Tone
Vivid
Best ink
White
11.45:1
Closest name
Medium Blue
ΔE2000 5.3
Where it sits
Hue251° of 360°
Saturation72%
Lightness38%
Temperature
Warm ← → Cool78% 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#331ba4
RGBrgb(51, 27, 164)
HSLhsl(251, 72%, 38%)
CMYKcmyk(69%, 84%, 0%, 36%)
LABlab(24.2 49.9 -68.3)
LCHlch(24.2 84.5 306.1)
OKLCHoklch(0.369 0.199 278.3)
Decimal3349412
Display P3color(display-p3 0.200 0.106 0.643)

Copy-ready code

/* CSS */
color: #331ba4;
background-color: #331ba4;
/* Tailwind (arbitrary) */
class="text-[#331ba4] bg-[#331ba4]"
/* SCSS */
$brand: #331ba4;
/* SwiftUI */
Color(red: 0.200, green: 0.106, blue: 0.643)
/* Android */
Color.parseColor("#331ba4")
/* Flutter */
Color(0xFF331BA4)
/* Python / OpenCV (BGR) */
(164, 27, 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 #331ba4 · 11.45:1
Use #ffffffAAA at every size.
Aa
White text · 11.45:1 · recommended
AA pass · AA large pass · AAA pass
Aa
Black text · 1.83:1
AA fail · AA large fail · AAA fail
Reading the other direction: #331ba4 as text scores 11.45:1 on white and 1.83:1 on black.

Accessibility — WCAG contrast

Aa
#331ba4 on white: 11.45:1
AA ✓ pass · AA-large · AAA
Aa
#331ba4 on black: 1.83:1
AA ✗ fail · AA-large · AAA
true color
protanopia · #003FA8
deuteranopia · #0034A2
tritanopia · #004761

Color scale — 50 to 950

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

#F5F3FC
#EAE7F8
#D0C9F3
#AD9FEF
#846FE7
#5B3EDF
#4123D2
#331ba4
#2C178C
#231566
#160D3F
Base = 700Lightest = 50 · #F5F3FCDarkest = 950 · #160D3F
:root {
  --brand-50: #F5F3FC;
  --brand-100: #EAE7F8;
  --brand-200: #D0C9F3;
  --brand-300: #AD9FEF;
  --brand-400: #846FE7;
  --brand-500: #5B3EDF;
  --brand-600: #4123D2;
  --brand-700: #331ba4;
  --brand-800: #2C178C;
  --brand-900: #231566;
  --brand-950: #160D3F;
  --brand: #331ba4;
  --brand-ink: #ffffff;
}

Colors that work with #331ba4

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#F5F4FA
Tinted page background
Border#C8C0ED
Hairlines and dividers
Muted text#594B9B
Captions on the surface
Accent#B3A819
Second voice, not a rival
Dark variant#22126D
Hover, pressed, headers
Light variant#ECE9FB
Selected rows, tints
Dark surface#171424
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 #331ba4

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#8CA41B
Analogous left#1B48A4
Analogous right#781BA4
Split-complement 1#A4781B
Split-complement 2#48A41B
Triadic 1#A4331B
Triadic 2#1BA433
Tetradic#A41B48

RGB percentages

Red20.0%
Green10.6%
Blue64.3%

CMYK percentages

Cyan68.9%
Magenta83.5%
Yellow0.0%
Key (black)35.7%

Color previews

#331ba4 text on a black background

contrast 1.83:1

Card sample

#331ba4 text on a white background

contrast 11.45:1

Card sample

CSS3 live lab

Text font color

The quick brown fox

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

Glowing headline

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

Soft neon halo

text-shadow: 0 0 14px rgba(51, 27, 164, 0.45);
Div box shadow
Elevated card
box-shadow: 0 12px 32px -8px rgba(51, 27, 164, 0.45);
Border & gradient
Gradient panel
border: 3px solid #331ba4;
background: linear-gradient(135deg, #331ba4, #8E1BA4);

Monochromatic scale

Palettes built from #331ba4

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.

#331ba4 in the real world

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

Industries
TechnologyFinanceHealthcareEnterprise SaaS
Common UI roles
ButtonsLinksFocus statesCharts
Print note

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

#331ba4, answered

What color is #331ba4?

#331ba4 is a dark vivid blue, closest to Medium Blue (ΔE2000 5.3). It sits at 251° on the hue wheel with 72% saturation and 38% lightness, which reads as cool.

What is the RGB value of #331ba4?

rgb(51, 27, 164) — 51 red, 27 green and 164 blue out of 255, or 20% / 10.6% / 64.3% by channel.

Is #331ba4 a light or a dark color?

It is a dark color. Relative luminance is 0.0417 and perceived brightness is 26%, so white text on it reaches 11.45:1.

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

White. It scores 11.45:1 against #331ba4, versus 1.83:1 for black — AAA at any size.

What is the complementary color of #331ba4?

#8CA41B sits directly opposite on the wheel. Softer options are the split-complements #A4781B and #48A41B, which give the same contrast with far less vibration.

What colors go well with #331ba4?

For interface work: #F5F4FA as the surface, #C8C0ED for borders, #594B9B for secondary text, #B3A819 as an accent and #22126D for hover and pressed states. For a palette, the analogous pair #1B48A4 and #781BA4 stays calm, while #8CA41B is the loudest partner.

What is #331ba4 in CMYK for printing?

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

Is #331ba4 warm or cool?

Cool — it scores 78 on a scale where 0 is the warmest orange and 100 the coolest azure. Nudged warmer it becomes #651BA4; nudged cooler, #1934A6.

Work with #331ba4 in the Color Lab