currentColor

'currentColor' (CSS)

[2] CSSキーワード 'currentColor' は、 その要素 ('color' 特性の値) を表します。

仕様書

意味

[6] 'currentColor' は、 'color' 特性の値を表します >>1

算出値

[7] 'currentColor'算出値は、 'color' 特性算出値です >>1

'color' における扱い

[8] 'color: currentColor''color: inherit' として扱います >>1

[9] PR 直前の WD <http://www.w3.org/TR/2008/WD-css3-color-20080721/#currentColor-def> までは 構文解析の時点で置き換えられると明記されていましたが、なぜか次の PR <http://www.w3.org/TR/2010/PR-css3-color-20101028/#currentColor-def> では削られています。

[23] Re: [css3-color] currentColor parsing issues (L. David Baron 著, 版) <http://lists.w3.org/Archives/Public/www-style/2008Jul/0540.html>

これによると、 CSSOM には 'currentColor' のまま現れるべきであり構文解析時に置き換えるというのは正しくないようです。

canvas での扱い

[26] CanvasRenderingContext2D では、

[29] CanvasGradientaddColorStop では、 完全不透明黒を表します。 >>25

歴史

前史

[3] CSS1CSS2 では 'border-color' 特性初期値を 「'color' 特性値」と文章で説明していました。 >>1

SVG

[4] SVG 1.0'fill', 'stroke', 'stop-color', 'flood-color', 'lighting-color' で使える値として 'currentColor' が導入されました。 >>1

CSS3

[5] CSS3'currentColor'<color> が使える場所すべてで使えるように拡張されました。 >>1

実装

[22] 2003年の CSS 3 モジュール CR によれば currentColorcolor に指定されたら構文解析の時点で inherit に置き換えなければなりませんが、 Firefox 2 はそれをせず、なぜか (初期値?) でレンダリングします。 background-color など他の特性では正常なようです。

メモ

[24] SVG 由来のため、 CSS なのに camelCase になっているようです。

[30] [css-color] currentColor, inheritance, bikeshedding ( (fantasai 著, 版)) <http://lists.w3.org/Archives/Public/www-style/2014Aug/0263.html>

[10] Revert behavior change of 2D context "currentColor" keyword (junov著, ) <https://github.com/whatwg/html/commit/c836c70ccff790f82b8a22f3f1897b3bcdcbd870>

[11] Clarify the definition of addColorStop() (Ms2ger著, ) <https://github.com/whatwg/html/commit/cc508ebd8427dd561ed2dc3d5d9a45a967fccf71>

[12] Clarify the definition of addColorStop by Ms2ger · Pull Request #3308 · whatwg/html () <https://github.com/whatwg/html/pull/3308>

[13] Editorial: align currentcolor with CSS (annevk著, ) <https://github.com/whatwg/html/commit/41dac2fd1720525c1bcc90395ecb577cb6473bb3>

[14] Editorial: align currentcolor with CSS by annevk · Pull Request #3496 · whatwg/html () <https://github.com/whatwg/html/pull/3496>