Skip to content

Basic HTML and CSS color

Navy #000080

Navy (CSS keyword navy) has the hex code #000080 and the RGB value rgb(0, 0, 128): a very dark, vivid blue.

Navy#000080

Navy (#000080) is one of the 16 original HTML colors, half-intensity blue. The name comes from the dark blue uniforms of the British Royal Navy.

Color codes for Navy

Color codes for Navy
CSS keywordnavy
HEX#000080
RGBrgb(0, 0, 128)
HSLhsl(240, 100%, 25%)
HWBhwb(240 0% 50%)
OKLCHoklch(27.1% 0.188 264.1)
CMYK (naive, no ICC profile)cmyk(100%, 100%, 0%, 50%)
Decimal128
Hue familyBlues

Contrast and accessibility

On navy, white text has a contrast ratio of 16.00:1 and passes AAA at any text size; black text reaches 1.31: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.

Contrast and accessibility
PairRatioAAAA largeAAAAAA largeAPCA Lc
Black text on navy1.31:1FailFailFailFail0.0
White text on navy16.00:1PassPassPassPass−103.9
Navy text on white16.00:1PassPassPassPass100.9
Navy text on black1.31:1FailFailFailFail0.0

Tints and shades

Each step mixes navy with white (tints) or black (shades) in gamma-encoded sRGB, the same result as color-mix(in srgb, navy, white 25%) in CSS.

Tints (mixed with white)

  1. 5%
    #0d0d86
  2. 15%
    #262693
  3. 25%
    #4040a0
  4. 35%
    #5959ac
  5. 45%
    #7373b9
  6. 55%
    #8c8cc6
  7. 65%
    #a6a6d3
  8. 75%
    #bfbfdf
  9. 85%
    #d9d9ec
  10. 95%
    #f2f2f9

Shades (mixed with black)

  1. 5%
    #00007a
  2. 15%
    #00006d
  3. 25%
    #000060
  4. 35%
    #000053
  5. 45%
    #000046
  6. 55%
    #00003a
  7. 65%
    #00002d
  8. 75%
    #000020
  9. 85%
    #000013
  10. 95%
    #000006

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, navy's complementary color is #372200 (close to darkslategray), its analogous colors are #002B48 and #320070, and its triadic partners are #550001 and #003300. For text on top, white gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#372200
Analogous−30°, +30°#002b48#320070
Triadic+120°, +240°#550001#003300
Split-complementary+150°, +210°#461500#272a00

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?

Navy 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 CSS named colors
ColorHEXΔE OK
darkblue#00008b2.0
midnightblue#1919705.4
mediumblue#0000cd13.7

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
violet-950#2f0d689.0
blue-950#1624569.8
indigo-950#1e1a4d10.6

Code snippets

CSS
.element {
  color: navy;
  background-color: #000080;
  border-color: rgb(0 0 128);
  outline-color: oklch(27.1% 0.188 264.1);
}
Tailwind CSS
<div class="bg-[#000080] text-white">...</div>

/* or register it once in your CSS (Tailwind v4) */
@theme {
  --color-navy: #000080;
}
/* then use bg-navy, text-navy, border-navy */
SwiftUI
import SwiftUI

extension Color {
  static let navy = Color(red: 0.000, green: 0.000, blue: 0.502)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

val Navy = Color(0xFF000080)
Flutter
import 'package:flutter/material.dart';

const navy = Color(0xFF000080);
Android XML
<!-- res/values/colors.xml -->
<color name="navy">#000080</color>

Frequently asked questions

What is the hex code for navy?
The hex code for navy is #000080. The same color is rgb(0, 0, 128), hsl(240, 100%, 25%) and oklch(27.1% 0.188 264.1), and in CSS you can also write the keyword navy directly.
Is navy a warm or cool color?
Navy 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 navy?
Rotating the hue in OKLCH while keeping lightness and chroma, navy's complementary color is #372200 (close to darkslategray), its analogous colors are #002B48 and #320070, and its triadic partners are #550001 and #003300. For text on top, white gives the higher contrast.
Can you use white text on navy?
White text on navy has a contrast ratio of 16.00:1, which passes both AA and AAA under WCAG 2.2. Black text reaches 1.31:1 and fails AA even for large text. In APCA terms that is Lc −103.9 for white and Lc 0.0 for black.
What is the RGB value of navy?
Navy is rgb(0, 0, 128): red 0, green 0 and blue 128 on the 0 to 255 scale, or 0.0%, 0.0% and 50.2%. As a decimal integer it is 128.

Last reviewed by Arielton Oberek.