CSS named color
MidnightBlue #191970
MidnightBlue (CSS keyword midnightblue) has the hex code #191970 and the RGB value rgb(25, 25, 112): a very dark, moderately saturated blue.
A very dark blue with a slight indigo cast (#191970), a little lighter and less saturated than navy. Often used as a softer alternative to black in dark themes.
Color codes for MidnightBlue
| CSS keyword | midnightblue |
|---|---|
| HEX | #191970 |
| RGB | rgb(25, 25, 112) |
| HSL | hsl(240, 64%, 27%) |
| HWB | hwb(240 10% 56%) |
| OKLCH | oklch(28.8% 0.144 272.8) |
| CMYK (naive, no ICC profile) | cmyk(78%, 78%, 0%, 56%) |
| Decimal | 1,644,912 |
| Hue family | Blues |
Contrast and accessibility
On midnightblue, white text has a contrast ratio of 14.84:1 and passes AAA at any text size; black text reaches 1.41: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 midnightblue | 1.41:1 | Fail | Fail | Fail | Fail | 0.0 |
| White text on midnightblue | 14.84:1 | Pass | Pass | Pass | Pass | −104.0 |
| Midnightblue text on white | 14.84:1 | Pass | Pass | Pass | Pass | 101.0 |
| Midnightblue text on black | 1.41:1 | Fail | Fail | Fail | Fail | 0.0 |
Tints and shades
Each step mixes midnightblue with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, midnightblue, white 25%) in CSS.
Tints (mixed with white)
- 5%
#252577 - 15%
#3c3c85 - 25%
#535394 - 35%
#6a6aa2 - 45%
#8181b0 - 55%
#9898bf - 65%
#afafcd - 75%
#c6c6db - 85%
#ddddea - 95%
#f4f4f8
Shades (mixed with black)
- 5%
#18186a - 15%
#15155f - 25%
#131354 - 35%
#101049 - 45%
#0e0e3e - 55%
#0b0b32 - 65%
#090927 - 75%
#06061c - 85%
#040411 - 95%
#010106
Color harmonies
Rotating the hue in OKLCH while keeping lightness and chroma, midnightblue's complementary color is #382900 (close to darkslategray), its analogous colors are #002D57 and #3A0663, and its triadic partners are #5D0000 and #00380D. For text on top, white gives the higher contrast.
| Harmony | Rotation | Color |
|---|---|---|
| Complementary | +180° | #382900 |
| Analogous | −30°, +30° | #002d57#3a0663 |
| Triadic | +120°, +240° | #5d0000#00380d |
| Split-complementary | +150°, +210° | #471e00#233100 |
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?
MidnightBlue is a cool color: its hue is 240° 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 Tailwind v4 colors
| Color | HEX | ΔE OK |
|---|---|---|
| violet-950 | #2f0d68 | 4.6 |
| blue-950 | #162456 | 5.4 |
| indigo-950 | #1e1a4d | 6.4 |
Code snippets
.element {
color: midnightblue;
background-color: #191970;
border-color: rgb(25 25 112);
outline-color: oklch(28.8% 0.144 272.8);
}<div class="bg-[#191970] text-white">...</div>
/* or register it once in your CSS (Tailwind v4) */
@theme {
--color-midnightblue: #191970;
}
/* then use bg-midnightblue, text-midnightblue, border-midnightblue */import SwiftUI
extension Color {
static let midnightblue = Color(red: 0.098, green: 0.098, blue: 0.439)
}import androidx.compose.ui.graphics.Color
val Midnightblue = Color(0xFF191970)import 'package:flutter/material.dart';
const midnightblue = Color(0xFF191970);<!-- res/values/colors.xml -->
<color name="midnightblue">#191970</color>Frequently asked questions
- What is the hex code for midnightblue?
- The hex code for midnightblue is #191970. The same color is rgb(25, 25, 112), hsl(240, 64%, 27%) and oklch(28.8% 0.144 272.8), and in CSS you can also write the keyword midnightblue directly.
- Is midnightblue a warm or cool color?
- MidnightBlue is a cool color: its hue is 240° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
- What colors go with midnightblue?
- Rotating the hue in OKLCH while keeping lightness and chroma, midnightblue's complementary color is #382900 (close to darkslategray), its analogous colors are #002D57 and #3A0663, and its triadic partners are #5D0000 and #00380D. For text on top, white gives the higher contrast.
- Can you use white text on midnightblue?
- White text on midnightblue has a contrast ratio of 14.84:1, which passes both AA and AAA under WCAG 2.2. Black text reaches 1.41:1 and fails AA even for large text. In APCA terms that is Lc −104.0 for white and Lc 0.0 for black.
- What is the RGB value of midnightblue?
- MidnightBlue is rgb(25, 25, 112): red 25, green 25 and blue 112 on the 0 to 255 scale, or 9.8%, 9.8% and 43.9%. As a decimal integer it is 1644912.
Last reviewed by Arielton Oberek.