CSS Function
currentColor
The currentColor keyword resolves to the computed value of the color property on the same element, enabling DRY color inheritance.
Syntax
property: currentColorParameters
| Name | Type | Required | Description |
|---|---|---|---|
| currentColor | keyword | Yes | Resolves to the element's computed color property value |
Examples
Icon inherits text color
SVG icon automatically matches the parent text color.
css
.icon {
fill: currentColor;
}Border matches text
Border automatically uses the same blue as the text.
css
.btn {
color: #3b82f6;
border: 1px solid currentColor;
}Tailwind fill-current
Tailwind's fill-current sets fill to currentColor.
html
<svg class="fill-current text-blue-500">...</svg>Browser Support
✓
Chrome
v1++
✓
Firefox
v1++
✓
Safari
v4++
✓
Edge
v12++
✓
Opera
v9.5++
Tailwind Equivalent
You can achieve similar results in Tailwind CSS using the following utility classes:
fill-current, stroke-current, border-current, text-current utilitiesFrequently Asked Questions
Is currentColor case-sensitive?▼
No. CSS keywords are case-insensitive: currentColor, currentcolor, and CURRENTCOLOR all work identically.
What properties default to currentColor?▼
border-color, text-decoration-color, outline-color, column-rule-color, and caret-color all default to currentColor when not explicitly set.
Explore CSS Color Tools
Try our free tools to work with currentColor and other CSS color functions.
Open Tools