inverted-colors

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

inverted-colorsCSSメディア特性で、ユーザーエージェントまたはその下の 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

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
inverted-colors media feature

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
User must explicitly enable this feature.

関連情報