Document colorsLimited availability
A document's bgColor, fgColor, alinkColor, linkColor, and vlinkColor properties get and set the background, foreground, active link, link, and visited link colors of that document.
Not yet supported in all major browsers — check the table and provide a fallback.
Discouraged: Document color attributes are superseded by CSS. Use instead: background-color, Color, CSS object model, getComputedStyle()
Browser support
DesktopChrome
1–63Not supported
64+Supportedsince Jan 23, 2018
Current: 155Edge
12+Supportedsince Jul 29, 2015
Current: 154Firefox
1–68Not supported
69+Supportedsince Sep 3, 2019
Current: 157Safari
1–10.1Not supported
11+Supportedsince Sep 19, 2017
Current: 27MobileChrome Android
18–63Not supported
64+Supportedsince Jan 23, 2018
Current: 155Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157Safari iOS
1–10.3Not supported
11+Supportedsince Sep 19, 2017
Current: 27How to use
Support is still inconsistent across browsers. Use feature detection and test carefully.
Example
Full syntax and examples are on MDN: alinkColor.
Feature detection
JS · check before using
if ("Document" in globalThis && "alinkColor" in Document.prototype) {
// Document.alinkColor is available
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (5). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Document.alinkColor | 64 | 12 | 69 | 11 | 64 | 79 | 11 |
| Document.bgColor | 64 | 12 | 69 | 11 | 64 | 79 | 11 |
| Document.fgColor | 64 | 12 | 69 | 11 | 64 | 79 | 11 |
| Document.linkColor | 64 | 12 | 69 | 11 | 64 | 79 | 11 |
| Document.vlinkColor | 64 | 12 | 69 | 11 | 64 | 79 | 11 |