Skip to content
violet · neutral

#331f38

a deep, soft violet · neutral · closest name: Midnight Blue

Token name suggestion: Midnight Plum

RGB
51, 31, 56
HSL
288°, 29%, 17%
CMYK
9, 45, 0, 78
Luminance
0.0197

#331f38 is a deep soft violet, 288° on the wheel and 55/100 on the cool side. Put white text on it (15.07:1). As text it scores 15.07:1 on white — safe at any size. Nearest name is Midnight Blue, nearest Tailwind family is zinc.

hsl(288 29% 17%)rgb(51 31 56)Base step 950AAA inkNeutral

At a glance

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

Hex
#331f38
Hue
288°
violet
Saturation
29%
soft
Lightness
17%
deep
Brightness
22%
HSV value
Perceived
16%
weighted brightness
Luminance
0.0197
WCAG relative
Temperature
Neutral
55/100 cool
Color family
Violet
Tone
Soft
Best ink
White
15.07:1
Closest name
Midnight Blue
ΔE2000 16.8
Chroma
19.5
LCH, 0–130ish
OKLCH L
0.276
perceptual lightness
Tailwind
zinc
500 · ΔE 28.6
Web-safe
#333333
nearest of 216
Where it sits
Hue288° of 360°
Saturation29%
Lightness17%
Saturation × lightness field

Left edge is grey, right edge is full chroma; top is white, bottom is black. The dot is #331f38.

Temperature
Warm ← → Cool55% cool

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

Luminance by channel
Red36%
Green50%
Blue14%

Green carries most of what the eye calls brightness — that is why WCAG weights it 0.7152.

Every format

HEX#331f38
HEX (8-digit)#331f38ff
RGBrgb(51, 31, 56)
RGBArgba(51, 31, 56, 1)
HSLhsl(288, 29%, 17%)
HSV / HSBhsv(288, 45%, 22%)
HWBhwb(288 12% 78%)
CMYKcmyk(9%, 45%, 0%, 78%)
LABlab(15.3 15.0 -12.4)
LCHlch(15.3 19.5 320.5)
OKLCHoklch(0.276 0.052 319.4)
XYZ (D65)xyz(2.57, 1.97, 3.99)
Decimal3350328
Display P3color(display-p3 0.200 0.122 0.220)
Web-safe#333333

Copy-ready code

every platformclick to select
/* CSS */
color: #331f38;
background-color: #331f38;
/* CSS custom property */
--brand: #331f38;
/* Tailwind (arbitrary) */
class="text-[#331f38] bg-[#331f38]"
/* SCSS */
$brand: #331f38;
/* SwiftUI */
Color(red: 0.200, green: 0.122, blue: 0.220)
/* UIKit */
UIColor(red: 0.200, green: 0.122, blue: 0.220, alpha: 1)
/* Android XML */
<color name="brand">#331F38</color>
/* Android Compose */
Color(0xFF331F38)
/* Flutter */
Color(0xFF331F38)
/* Python / OpenCV (BGR) */
(56, 31, 51)
/* Python / PIL (RGB) */
(51, 31, 56)
/* Java AWT */
new Color(51, 31, 56)
/* .NET */
Color.FromArgb(255, 51, 31, 56)
/* OpenGL / Unity (0–1) */
(0.2000f, 0.1216f, 0.2196f, 1f)
/* LaTeX */
\definecolor{brand}{RGB}{51,31,56}
modern cssclick to select
/* mix without leaving CSS */
background: color-mix(in oklab, #331f38 85%, white);
border-color: color-mix(in oklab, #331f38 40%, transparent);
/* theme-aware in one line */
color: light-dark(#4B2D52, #E6D8E9);
/* relative colour syntax */
--hover: hsl(from #331f38 h s calc(l - 7));

Design tokens

The same ramp in the four formats a team actually needs. Paste one and the whole palette lands with it.

css custom propertiesclick to select
:root {
  --brand-50: #F8F6F9;
  --brand-100: #F2ECF3;
  --brand-200: #E3D5E6;
  --brand-300: #D1B7D7;
  --brand-400: #B993C3;
  --brand-500: #A26FAF;
  --brand-600: #8F579E;
  --brand-700: #784983;
  --brand-800: #603A69;
  --brand-900: #472D4D;
  --brand-950: #331f38;
  --brand: #331f38;
  --brand-ink: #ffffff;
  --brand-surface: #F9F5FA;
  --brand-border: #DDCAE2;
  --brand-hover: #1E1221;
  --brand-pressed: #09060A;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-surface: #211424;
    --brand-ink: #E6D8E9;
  }
}
tailwind.config.jsclick to select
theme: {
  extend: {
    colors: {
      brand: {
        50: '#F8F6F9',
        100: '#F2ECF3',
        200: '#E3D5E6',
        300: '#D1B7D7',
        400: '#B993C3',
        500: '#A26FAF',
        600: '#8F579E',
        700: '#784983',
        800: '#603A69',
        900: '#472D4D',
        950: '#331f38',
        DEFAULT: '#331f38',
      },
    },
  },
}
scss mapclick to select
$brand: (
  '50': #F8F6F9,
  '100': #F2ECF3,
  '200': #E3D5E6,
  '300': #D1B7D7,
  '400': #B993C3,
  '500': #A26FAF,
  '600': #8F579E,
  '700': #784983,
  '800': #603A69,
  '900': #472D4D,
  '950': #331f38,
);
$brand-base: #331f38;
$brand-ink: #ffffff;

@function brand($step) { @return map-get($brand, $step); }
w3c design tokens (json)click to select
{
  "color": {
    "brand": {
      "50": { "$value": "#F8F6F9", "$type": "color" },
      "100": { "$value": "#F2ECF3", "$type": "color" },
      "200": { "$value": "#E3D5E6", "$type": "color" },
      "300": { "$value": "#D1B7D7", "$type": "color" },
      "400": { "$value": "#B993C3", "$type": "color" },
      "500": { "$value": "#A26FAF", "$type": "color" },
      "600": { "$value": "#8F579E", "$type": "color" },
      "700": { "$value": "#784983", "$type": "color" },
      "800": { "$value": "#603A69", "$type": "color" },
      "900": { "$value": "#472D4D", "$type": "color" },
      "950": { "$value": "#331f38", "$type": "color" }
    },
    "brandInk": { "$value": "#ffffff", "$type": "color" }
  }
}

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 #331f38 · 15.07:1
Use #ffffffAAA at every size.
Aa
12px
Aa
16px
Aa
24px
Aa
White text · 15.07:1 · recommended
AA pass · AA large pass · AAA pass
Aa
Black text · 1.39:1
AA fail · AA large fail · AAA fail
Reading the other direction: #331f38 as text scores 15.07:1 on white and 1.39:1 on black.
Best tinted ink on it, if plain black or white feels flat: #F4EFF6 at 13.29:1.

Make it accessible

A contrast checker tells you that you failed. This tells you what to ship instead — same hue, same saturation, lightness moved only as far as WCAG demands.

The quick fox
#331f38 · 15.07:1
AA on whitealready passes
#331f38
The quick fox
#331f38 · 15.07:1
AAA on whitealready passes
#331f38
The quick fox
#985FA6 · 4.52:1
AA on black+34% L
#985FA6
The quick fox
#B186BC · 7.01:1
AAA on black+46% L
#B186BC

Large text — 24px regular or 18.66px bold and above — only needs 3:1, so #331F38 is enough for headings on white. Non-text elements such as icons, chart strokes and focus rings also sit at 3:1 under WCAG 2.2 (1.4.11).

Accessibility — WCAG contrast

Aa
#331f38 on white: 15.07:1
AA ✓ pass · AA-large · AAA
Aa
#331f38 on black: 1.39:1
AA ✗ fail · AA-large · AAA
Against the neutral ladder

Contrast is symmetric, so each row covers both directions: #331f38 as text on that neutral, and that neutral as text on #331f38.

NeutralRatioBoth directions
White15.07:1AaAa
Slate 5014.40:1AaAa
Slate 10013.75:1AaAa
Slate 20012.22:1AaAa
Slate 30010.15:1AaAa
Slate 4005.88:1AaAa
Slate 5003.17:1AaAa
Slate 6001.99:1AaAa
Slate 7001.45:1AaAa
Slate 8001.03:1AaAa
Slate 9001.18:1AaAa
Black1.39:1AaAa
Colour vision deficiency
true color
protanopia · #1C2539
deuteranopia · #212737
tritanopia · #332228

Roughly one man in twelve has some form of colour vision deficiency. If any of the three panels above is hard to tell apart from a neighbouring colour in your palette, add a shape, an icon or a label so the meaning does not rest on hue alone.

Color scale — 50 to 950

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

#F8F6F9
#F2ECF3
#E3D5E6
#D1B7D7
#B993C3
#A26FAF
#8F579E
#784983
#603A69
#472D4D
#331f38
Base = 950Lightest = 50 · #F8F6F9Darkest = 950 · #331f38Text step on white = 600
Perceptual ramp — OKLCH

The same eleven steps expressed in OKLCH, where equal lightness numbers actually look equally spaced. HSL ramps go muddy in the yellows and washed out in the blues; this one does not. Modern browsers render it natively — the hex ramp above is the fallback.

50100200300400500600700800900950
oklch tokensclick to select
:root {
  --brand-50: oklch(0.97 0.013 319.4);
  --brand-100: oklch(0.94 0.021 319.4);
  --brand-200: oklch(0.88 0.031 319.4);
  --brand-300: oklch(0.80 0.041 319.4);
  --brand-400: oklch(0.72 0.048 319.4);
  --brand-500: oklch(0.64 0.052 319.4);
  --brand-600: oklch(0.56 0.052 319.4);
  --brand-700: oklch(0.48 0.049 319.4);
  --brand-800: oklch(0.40 0.044 319.4);
  --brand-900: oklch(0.32 0.037 319.4);
  --brand-950: oklch(0.24 0.029 319.4);
}

Colors that work with #331f38

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#F9F5FA
Tinted page background
Border#DDCAE2
Hairlines and dividers
Muted text#875294
Captions on the surface
Accent#2A3A1D
Second voice, not a rival
Dark variant#4B2D52
Hover, pressed, headers
Light variant#F4EFF6
Selected rows, tints
Dark surface#211424
Dark-mode background
Hover#1E1221
One step down in lightness
Pressed#09060A
Two steps down
Disabled#714E7A
Chroma pulled out
Focus ring#42214B
Offset from the fill so it reads
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

In real components

The same eight roles, wired into the interface patterns you will actually build with them. Every state below is a computed value, not a mock-up.

Buttons and states
Save changesHoverPressedDisabled
OutlineSubtleLinkFocused
Form field
you@company.com

Focus ring uses the light variant so the field still reads as one shape.

Send me product updates
Notice
Your export is ready

The file stays available for seven days. Download it before it expires.

NewBetaDraft
Data
Storage used68%
Acme LtdActive
NorthwindTrial
GlobexActive

How to use #331f38

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

Works well for
  • Body text and links on white
  • Charts, tags and secondary surfaces
  • Headers, footers and dark-mode surfaces
  • Brand accents, badges and data highlights
Use with care
  • Text on black or near-black surfaces
  • Black text placed on it
  • Pairing with a same-lightness hue — edges vibrate
Minimum size as text on white
Any size
Safe as a fill behind white type
Yes
Safe as a 1px border on white
Yes

Meaning and mood

What a colour in this family tends to signal, and how this particular chroma and lightness change the reading.

creativepremiummodernimaginative

Violet sits between the warmth of red and the calm of blue, so it reads as inventive without reading as risky. Current shorthand for software craft.

The muted chroma softens the association — it reads considered rather than loud, which suits long-form and data-heavy screens. The low lightness adds weight and formality.

Worth knowing

Deep violets swallow detail on screens with poor gamma; check it on a cheap laptop panel.

Reads as
  • FormalityHigh
  • EnergyMedium
  • Weight83/100
  • TemperatureNeutral
  • ApproachabilityBalanced

Colour associations are cultural and vary by market. Treat these as a starting point for a conversation with your audience, not a finding about them.

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#24381F
Analogous left#271F38
Analogous right#381F31
Split-complement 1#31381F
Split-complement 2#1F3827
Triadic 1#38331F
Triadic 2#1F3833
Tetradic#38271F
On the wheel
Base+30°−30°+120°+240°+180°288°

#331f38 sits at 288°. Every dot is a harmony position and links to its own page in the table alongside.

RGB percentages

Red20.0%
Green12.2%
Blue22.0%
R · 0–255
51
0x33
G · 0–255
31
0x1f
B · 0–255
56
0x38

CMYK percentages

Cyan8.9%
Magenta44.6%
Yellow0.0%
Key (black)78.0%

Total ink coverage is 132%. Most commercial presses cap around 300% — above that, sheets stop drying properly.

Color previews

#331f38 text on a black background

contrast 1.39:1

Card sample

#331f38 text on a white background

contrast 15.07:1

Card sample

#331f38 on grey

13.75:1

#331f38 on its own surface

13.97:1

#331f38 on its dark surface

1.17:1

CSS3 live lab

Text font color

The quick brown fox

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

Glowing headline

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

Soft neon halo

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

Gradient headline

background: linear-gradient(90deg, #331f38, #381F26);
-webkit-background-clip: text;
color: transparent;
Focus ring
Focused control
outline: 2px solid #331f38;
outline-offset: 3px;
Underline & caret

Marked up text

text-decoration-color: #331f38;
caret-color: #331f38;
Left rule
Pull quote or callout
border-left: 4px solid #331f38;
Ring + tint
Selected chip
background: #F4EFF6;
box-shadow: inset 0 0 0 2px #331f38;
Conic badge
68%
background: conic-gradient(#331f38 68%, #e2e8f0 0);

Transparency

What each alpha value actually composites to. The top row is #331f38 over white; the bottom row is the same alpha over a checkerboard, so you can see what survives on a photo or a video.

Bottom row of hexes is the flattened result over white — use those when a design tool refuses transparency, or when you need a solid fallback.

alpha in every syntaxclick to select
rgba(51, 31, 56, 0.5)
rgb(51 31 56 / 50%)
#331f3880
hsl(288 29% 17% / 50%)
color-mix(in srgb, #331f38 50%, transparent)
Alpha8-digit hexFlat on white
10%#331f381a#EBE9EB
20%#331f3833#D6D2D7
40%#331f3866#ADA5AF
60%#331f3899#857988
80%#331f38cc#5C4C60

Gradients from #331f38

Six recipes, each built from this hex and shown with the exact CSS that produced it.

Elevation
Same hue, three lightnesses — safe anywhere
background: linear-gradient(135deg, #573560, #331f38 45%, #4B2D52);
Duotone
A short hue run reads richer than a flat fill
background: linear-gradient(120deg, #331f38, #24141B);
Complement sweep
Loud — keep it behind large type only
background: linear-gradient(90deg, #331f38, #24381F);
Spotlight
Hero panels and app headers
background: radial-gradient(120% 120% at 20% 0%, #694073 0%, #331f38 45%, #4B2D52 100%);
Soft wash
Section backgrounds that stay readable
background: linear-gradient(180deg, #F9F5FA, #ffffff);
Mesh
Ambient background, no image weight
background: radial-gradient(60% 60% at 15% 20%, #3A3159 0%, transparent 60%), radial-gradient(55% 55% at 85% 15%, #4C2A3F 0%, transparent 60%), radial-gradient(70% 70% at 50% 95%, #4B2D52 0%, transparent 65%), #331f38;

Monochromatic scale

Palettes built from #331f38

Shades — darker

Tints — lighter

Tones — desaturated

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.

#331f38 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.

On screens

Very dark values collapse into each other on cheap panels — leave more lightness between your darkest steps than the numbers suggest.

In dark mode

Too dim on dark surfaces at 1.39:1 — lift it to #985FA6 for body text, or reserve it for fills.

Explore nearby colors

Small, deliberate steps away from this hex — useful when you are hunting for the version of a colour that finally feels right.

#331f38, answered

What color is #331f38?

#331f38 is a deep soft violet, closest to Midnight Blue (ΔE2000 16.8). It sits at 288° on the hue wheel with 29% saturation and 17% lightness, which reads as neutral.

What is the RGB value of #331f38?

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

What is #331f38 in HSL and HSV?

hsl(288, 29%, 17%) and hsv(288, 45%, 22%). HSL is what CSS takes; HSV is what your design tool's picker shows, which is why the saturation numbers rarely match.

Is #331f38 a light or a dark color?

It is a dark color. Relative luminance is 0.0197 and perceived brightness is 16%, so white text on it reaches 15.07:1.

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

White. It scores 15.07:1 against #331f38, versus 1.39:1 for black — AAA at any size.

Is #331f38 accessible on a white background?

#331f38 on white scores 15.07:1, which clears AAA at every size.

What is the complementary color of #331f38?

#24381F sits directly opposite on the wheel. Softer options are the split-complements #31381F and #1F3827, which give the same contrast with far less vibration.

What colors go well with #331f38?

For interface work: #F9F5FA as the surface, #DDCAE2 for borders, #875294 for secondary text, #2A3A1D as an accent and #4B2D52 for hover and pressed states. For a palette, the analogous pair #271F38 and #381F31 stays calm, while #24381F is the loudest partner.

What is #331f38 in CMYK for printing?

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

Is #331f38 warm or cool?

Neutral — it scores 55 on a scale where 0 is the warmest orange and 100 the coolest azure. Nudged warmer it becomes #381F34; nudged cooler, #2A1E39.

Which Tailwind color is closest to #331f38?

The zinc family — its 500 step is #71717a, ΔE2000 28.6 away. That is a visible difference, so define #331f38 as a custom token rather than reaching for the built-in.

How do I use #331f38 in Tailwind CSS?

Inline it as an arbitrary value with bg-[#331f38] or text-[#331f38], or register the whole ramp under theme.extend.colors.brand so you get bg-brand-500 and friends. The generated 50–950 scale on this page is ready to paste into your config.

What is #331f38 with 50% opacity?

rgba(51, 31, 56, 0.5), or #331f3880 in eight-digit hex. Over white that composites to #998F9C; over black, #1A101C.

Is #331f38 a web-safe color?

No. The nearest web-safe colour is #333333, ΔE2000 16.7 away. The palette only matters for legacy displays and some email clients now.

What does the color #331f38 mean?

As a violet, it reads creative, premium, modern. Violet sits between the warmth of red and the calm of blue, so it reads as inventive without reading as risky. Current shorthand for software craft. At this moderate chroma the association is present but not shouted.

What gradient works with #331f38?

The safest is same-hue elevation: linear-gradient(135deg, #573560, #331f38 45%, #4B2D52). For more colour, a short hue run to #24141B keeps it rich without turning muddy.

Work with #331f38 in the Color Lab

Every tool opens with this colour already loaded.

Every value on this page is computed from #331f38 at request time — conversions, contrast ratios and ΔE distances are calculated, never looked up.