ウィンドウscreen.pixelDepth
例
画面の色解像度を取得します。
let depth = screen.pixelDepth;
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
プロパティは、画面のpixelDepth
色深度を返します。
このpixelDepth
プロパティは、ピクセルあたりのビット数で色深度を返します。
pixelDepth
プロパティは読み取り専用です。
関連項目:
screen.colorDepthプロパティ
ノート
pixelDepthプロパティは、Internet Explorer9以前ではサポートされていません。
ただし、pixelDepthとcolorDepthは同じ値を返します。
すべてのブラウザはcolorDepthをサポートしているため、代わりにそのプロパティを使用してください。
構文
screen.pixelDepth
戻り値
タイプ | 説明 |
数 | ピクセルあたりのビット数で表した色解像度: 1、4、8、15、16、24、32、または48。 |
その他の例
すべての画面プロパティ:
let text = "Total width/height: " + screen.width + "*" + screen.height + "<br>" +
"Available width/height: " + screen.availWidth + "*" + screen.availHeight + "<br>" +
"Color depth: " + screen.colorDepth + "<br>" +
"Color resolution: " + screen.pixelDepth;
ブラウザのサポート
screen.pixelDepth
すべてのブラウザでサポートされています:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |