currentcolor
/* Keyword values */ color: currentcolor;/* <named-color> values */ color: red; color: orange; color: tan; color: rebeccapurple;
/* <hex-color> values */ color: #090; color: #009900; ...
Every so often I discover that CSS has some feature I've kind of wanted for
years and didn't realize was there. Today I learned about currentcolor.
This feature is mentioned here
and it links you to here,
but you'll need to go find blog posts that explain just how darn useful it is.
What is it? It's basically a special variable that contains the currently set color. It's pretty much exactly what you want for, say, monochromatic svg icons almost all of the time:
svg {
fill: currentcolor;
}
Now, wouldn't it be nice if there were a similar value for background-color?
You can set background-color to currentcolor (which is not helpful) but no
there is not.
Does this seem like a hack? You bet. Do I wish I'd known about this, I dunno, some time between 2010 when it seems like it was implemented in webkit? Um, yeah.
God damn it.