Skip to content

CSS named color

RoyalBlue #4169E1

RoyalBlue (CSS keyword royalblue) has the hex code #4169E1 and the RGB value rgb(65, 105, 225): a medium-dark, vivid blue.

RoyalBlue#4169E1

A strong, medium blue (#4169e1). It has enough contrast with white for large text and is a common brand and button blue.

Color codes for RoyalBlue

Color codes for RoyalBlue
CSS keywordroyalblue
HEX#4169E1
RGBrgb(65, 105, 225)
HSLhsl(225, 73%, 57%)
HWBhwb(225 25% 12%)
OKLCHoklch(56% 0.188 266.4)
CMYK (naive, no ICC profile)cmyk(71%, 53%, 0%, 12%)
Decimal4,286,945
Hue familyBlues

Contrast and accessibility

On royalblue, white text has a contrast ratio of 4.84:1 and passes AA for normal text; black text reaches 4.33: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 royalblue4.33:1FailPassFailFail30.9
White text on royalblue4.84:1PassPassFailPass−78.6
Royalblue text on white4.84:1PassPassFailPass73.2
Royalblue text on black4.33:1FailPassFailFail−28.5

Tints and shades

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

Tints (mixed with white)

  1. 5%
    #4b71e3
  2. 15%
    #5e80e6
  3. 25%
    #718fe9
  4. 35%
    #849eec
  5. 45%
    #97adef
  6. 55%
    #aabcf2
  7. 65%
    #bdcbf5
  8. 75%
    #d0daf8
  9. 85%
    #e3e9fb
  10. 95%
    #f6f8fe

Shades (mixed with black)

  1. 5%
    #3e64d6
  2. 15%
    #3759bf
  3. 25%
    #314fa9
  4. 35%
    #2a4492
  5. 45%
    #243a7c
  6. 55%
    #1d2f65
  7. 65%
    #17254f
  8. 75%
    #101a38
  9. 85%
    #0a1022
  10. 95%
    #03050b

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, royalblue's complementary color is #966D00 (close to olive), its analogous colors are #007EBE and #8254D3, and its triadic partners are #CB3532 and #008F20. For text on top, white gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#966d00
Analogous−30°, +30°#007ebe#8254d3
Triadic+120°, +240°#cb3532#008f20
Split-complementary+150°, +210°#b75500#707e00

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?

RoyalBlue is a cool color: its hue is 225° 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
slateblue#6a5acd6.4
mediumslateblue#7b68ee7.8
dodgerblue#1e90ff10.2

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
blue-600#155dfc6.0
indigo-500#615fff6.5
blue-500#2b7fff7.2

Code snippets

CSS
.element {
  color: royalblue;
  background-color: #4169e1;
  border-color: rgb(65 105 225);
  outline-color: oklch(56% 0.188 266.4);
}
Tailwind CSS
<div class="bg-[#4169e1] text-white">...</div>

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

extension Color {
  static let royalblue = Color(red: 0.255, green: 0.412, blue: 0.882)
}
Jetpack Compose
import androidx.compose.ui.graphics.Color

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

const royalblue = Color(0xFF4169E1);
Android XML
<!-- res/values/colors.xml -->
<color name="royalblue">#4169E1</color>

Frequently asked questions

What is the hex code for royalblue?
The hex code for royalblue is #4169E1. The same color is rgb(65, 105, 225), hsl(225, 73%, 57%) and oklch(56% 0.188 266.4), and in CSS you can also write the keyword royalblue directly.
Is royalblue a warm or cool color?
RoyalBlue is a cool color: its hue is 225° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
What colors go with royalblue?
Rotating the hue in OKLCH while keeping lightness and chroma, royalblue's complementary color is #966D00 (close to olive), its analogous colors are #007EBE and #8254D3, and its triadic partners are #CB3532 and #008F20. For text on top, white gives the higher contrast.
Can you use white text on royalblue?
White text on royalblue has a contrast ratio of 4.84:1, which passes AA for normal text but not AAA under WCAG 2.2. Black text reaches 4.33:1 and passes AA only for large text (24 px, or 18.66 px bold, and up). In APCA terms that is Lc −78.6 for white and Lc 30.9 for black.
What is the RGB value of royalblue?
RoyalBlue is rgb(65, 105, 225): red 65, green 105 and blue 225 on the 0 to 255 scale, or 25.5%, 41.2% and 88.2%. As a decimal integer it is 4286945.

Last reviewed by Arielton Oberek.