In CSS the special variable currentColor
gives you access to the current text color of the element. You can use this value in other properties like border-color
to automatically adjust the border to match the text color.
.button {
border: 1px solid currentColor; /* border color is blue */
color: blue;
}
.button:hover {
/* border color automatically changes to darkblue */
color: darkblue;
}