inverted-colors
inverted-colors
は CSS のメディア特性で、ユーザーエージェントまたはその下の OS が色を反転しているかどうかを調べるために使用することができます。
構文
inverted-colors
特性は以下の一覧のうち一つのキーワード値で指定します。
none
-
色が通常通り表示されます。
inverted
-
表示領域内のすべてのピクセルが反転されています。
例
HTML
html
<p>
If you're using inverted colors, this text should be blue on white (the
inverse of yellow on black). If you're not, it should be red on light gray.
</p>
<p>
If the text is gray, your browser doesn't support the `inverted-colors` media
feature.
</p>
CSS
css
p {
color: gray;
}
@media (inverted-colors: inverted) {
p {
background: black;
color: yellow;
}
}
@media (inverted-colors: none) {
p {
background: #eee;
color: red;
}
}
結果
仕様書
Specification |
---|
Media Queries Level 5 # inverted |
ブラウザーの互換性
BCD tables only load in the browser