How to Choose Hover Colors: Lighter & Darker Hex Values
The whole decision comes down to one rule: move the color away from the page background. On a light page, darken on hover. On a dark page, lighten. Roughly 10–12% for hover and 20% for the pressed state is enough to register as a state change without reading as a different color entirely. Everything below is that rule, worked through with real hex values and real contrast ratios.
Why the background decides, not the button
A hover state has exactly one job: confirm that the pointer is on the thing the user thinks it is on. Moving the element further from the page background increases its separation from the page, which reads as coming forward. Moving it toward the background reads as sinking — which is a perfectly good signal for a pressed state, and the wrong one for hover.
That is why "lighten on hover" is not a rule. It is the right rule on a dark interface and the wrong one on a white page, where lightening a button nudges it toward invisibility.
Worked example: a blue button on a white page
Start from #2563EB. With a white label it measures 5.17:1, comfortably past the WCAG AA threshold of 4.5:1 for normal text. Now darken it by multiplying each channel by (1 − factor):
| State | Operation | Hex | White text |
|---|---|---|---|
| Resting | base | #2563EB | 5.17:1 |
| Hover | darken 12% | #2157CF | 6.31:1 |
| Active | darken 20% | #1E4FBC | 7.24:1 |
Note what happens to contrast: it goes up at every step, because the label stays white and the background gets darker. Darkening on a light page is the safe direction — it can only improve legibility of light text.
Note also what the hover does not do. Measured against its own resting color, #2157CF is only 1.22:1. That sounds alarming and is completely fine: WCAG has no contrast requirement between two states of the same control. The requirement is that each state has enough contrast with its own text and with the surrounding page. A visible nudge is all a hover needs to be.
If you are on Tailwind, the same move is prebuilt: blue-600 → blue-700 → blue-800 is #2563EB → #1D4ED8 → #1E40AF, measuring 5.17:1, 6.70:1, and 8.72:1 against white. Any evenly stepped ramp works the same way, which is the argument for generating one up front in the tint and shade generator rather than eyeballing each state. To pick a single step by an exact percentage, use the darken color tool.
The same button on a dark page
Put #3B82F6 on a #0F172A background and it sits at 4.85:1 against the page. Darkening it on hover would push it toward the background and make it harder to see. Lighten instead:
new_channel = old_channel + (255 − old_channel) × 0.10
#3B82F6 → #4F8FF7 (4.85:1 → 5.61:1 against the page)
Same rule, opposite direction, same result: the button separates further from its surroundings. The lighten color tool will give you any percentage step of your own base color.
Hovers for things that have no fill
Text links, ghost buttons, and menu items have no background to darken. Three options that work, in rough order of robustness:
- Add a tinted background. The 50 or 100 step of your color ramp — something like
#EFF6FFfor a blue system — appears on hover and gives the element a shape it did not have before. - Darken the text one step.
#2563EBat 5.17:1 on white becomes#1D4ED8at 6.70:1. Subtle, and it keeps the layout perfectly still. - Underline. The only one of the three that survives forced-colors mode, works at any contrast, and is visible to someone who cannot distinguish your two blues at all.
Whichever you choose, do not let color be the only difference between states. An underline, a shadow, a border, or a small movement gives the state a second channel.
The contrast rules that actually apply
- Text on each state: 4.5:1 for normal text, 3:1 for large text (18pt, or 14pt bold).
- The control's boundary against the page: 3:1, under WCAG 1.4.11 non-text contrast.
- The focus indicator against adjacent colors: 3:1.
- Resting against hover: no requirement at all.
Three of those four are worth measuring rather than guessing. Paste any pair into the contrast checker and it reports the ratio with AA and AAA verdicts for both normal and large text.
Wiring it into CSS
Put the three values in tokens so the ratios stay visible in the code and nobody has to rediscover them:
:root {
--btn: #2563EB; /* 5.17:1 with white */
--btn-hover: #2157CF; /* 6.31:1 with white */
--btn-active: #1E4FBC; /* 7.24:1 with white */
}
.btn { background: var(--btn); color: #fff; transition: background-color .12s ease; }
.btn:hover { background: var(--btn-hover); }
.btn:active { background: var(--btn-active); }
.btn:focus-visible { outline: 3px solid #1E40AF; outline-offset: 2px; }
Two details that are easy to miss. Use :focus-visible rather than :focus, so the ring appears for keyboard users without flashing on every mouse click. And remember that :hover does not exist on touch — never make it the only way to discover that something is interactive.
A checklist before you ship
- Is the hover moving away from the page background?
- Is the step big enough to notice and small enough to still read as the same control? 10–12% is the usual answer.
- Does the text still pass 4.5:1 on every state, not just the resting one?
- Is there a non-color cue as well?
- Is the focus ring at least 3:1 against what is behind it?
Generate the full ramp once in the color scale generator, lock in the three steps, and every hover decision after that is already made.