Skip to content

Basic HTML and CSS color

Green #008000

Green (CSS keyword green) has the hex code #008000 and the RGB value rgb(0, 128, 0): a medium-dark, vivid green.

Green#008000

CSS green (#008000) is half-intensity green from the HTML palette. The pure #00ff00 primary is called lime in CSS, a difference from X11, where green meant #00ff00.

Color codes for Green

Color codes for Green
CSS keywordgreen
HEX#008000
RGBrgb(0, 128, 0)
HSLhsl(120, 100%, 25%)
HWBhwb(120 0% 50%)
OKLCHoklch(52% 0.177 142.5)
CMYK (naive, no ICC profile)cmyk(100%, 0%, 100%, 50%)
Decimal32,768
Hue familyGreens

Contrast and accessibility

On green, white text has a contrast ratio of 5.13:1 and passes AA for normal text; black text reaches 4.08: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 green4.08:1FailPassFailFail29.5
White text on green5.13:1PassPassFailPass−80.0
Green text on white5.13:1PassPassFailPass74.6
Green text on black4.08:1FailPassFailFail−27.1

Tints and shades

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

Tints (mixed with white)

  1. 5%
    #0d860d
  2. 15%
    #269326
  3. 25%
    #40a040
  4. 35%
    #59ac59
  5. 45%
    #73b973
  6. 55%
    #8cc68c
  7. 65%
    #a6d3a6
  8. 75%
    #bfdfbf
  9. 85%
    #d9ecd9
  10. 95%
    #f2f9f2

Shades (mixed with black)

  1. 5%
    #007a00
  2. 15%
    #006d00
  3. 25%
    #006000
  4. 35%
    #005300
  5. 45%
    #004600
  6. 55%
    #003a00
  7. 65%
    #002d00
  8. 75%
    #002000
  9. 85%
    #001300
  10. 95%
    #000600

Color harmonies

Rotating the hue in OKLCH while keeping lightness and chroma, green's complementary color is #963BA3 (close to darkorchid), its analogous colors are #6B6F00 and #007E61, and its triadic partners are #2C61CD and #B92C36. For text on top, white gives the higher contrast.

Color harmonies
HarmonyRotationColor
Complementary+180°#963ba3
Analogous−30°, +30°#6b6f00#007e61
Triadic+120°, +240°#2c61cd#b92c36
Split-complementary+150°, +210°#6f4dc3#af2d72

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?

Green is a cool color: its hue is 120° 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
forestgreen#228b223.9
seagreen#2e8b578.2
darkgreen#0064008.8

Nearest Tailwind v4 colors

Nearest Tailwind v4 colors
ColorHEXΔE OK
green-700#0082363.2
lime-700#497d003.9
emerald-700#007a558.3

Code snippets

CSS
.element {
  color: green;
  background-color: #008000;
  border-color: rgb(0 128 0);
  outline-color: oklch(52% 0.177 142.5);
}
Tailwind CSS
<div class="bg-[#008000] text-white">...</div>

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

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

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

const green = Color(0xFF008000);
Android XML
<!-- res/values/colors.xml -->
<color name="green">#008000</color>

Frequently asked questions

What is the hex code for green?
The hex code for green is #008000. The same color is rgb(0, 128, 0), hsl(120, 100%, 25%) and oklch(52% 0.177 142.5), and in CSS you can also write the keyword green directly.
Is green a warm or cool color?
Green is a cool color: its hue is 120° on the HSL wheel, in the green, blue and violet range that is conventionally called cool.
What colors go with green?
Rotating the hue in OKLCH while keeping lightness and chroma, green's complementary color is #963BA3 (close to darkorchid), its analogous colors are #6B6F00 and #007E61, and its triadic partners are #2C61CD and #B92C36. For text on top, white gives the higher contrast.
Can you use white text on green?
White text on green has a contrast ratio of 5.13:1, which passes AA for normal text but not AAA under WCAG 2.2. Black text reaches 4.08:1 and passes AA only for large text (24 px, or 18.66 px bold, and up). In APCA terms that is Lc −80.0 for white and Lc 29.5 for black.
What is the RGB value of green?
Green is rgb(0, 128, 0): red 0, green 128 and blue 0 on the 0 to 255 scale, or 0.0%, 50.2% and 0.0%. As a decimal integer it is 32768.

Last reviewed by Arielton Oberek.