blob: ded77035aa8964d432e0c2638f0356f8e38ca006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
---
title: inverted-colors
slug: Web/CSS/@media/inverted-colors
tags:
- '@media'
- CSS
- メディアクエリー
- リファレンス
- メディア特性
browser-compat: css.at-rules.media.inverted-colors
translation_of: Web/CSS/@media/inverted-colors
---
{{CSSRef}}
**`inverted-colors`** は [CSS](/ja/docs/Web/CSS) の[メディア特性](/ja/docs/Web/CSS/@media#メディア特性)で、{{glossary("user agent", "ユーザーエージェント")}}またはその下の 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;
}
}
```
### 結果
{{EmbedLiveSample("Examples")}}
## 仕様書
{{Specifications}}
## ブラウザーの互換性
{{Compat}}
## 関連情報
- [メディアクエリーの使用](/ja/docs/Web/CSS/Media_Queries/Using_media_queries)
- [@media](/ja/docs/Web/CSS/@media)
|