diff options
Diffstat (limited to 'files/zh-cn/web/api/screen/pixeldepth/index.html')
| -rw-r--r-- | files/zh-cn/web/api/screen/pixeldepth/index.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/screen/pixeldepth/index.html b/files/zh-cn/web/api/screen/pixeldepth/index.html new file mode 100644 index 0000000000..c96b7e4253 --- /dev/null +++ b/files/zh-cn/web/api/screen/pixeldepth/index.html @@ -0,0 +1,51 @@ +--- +title: Screen.pixelDepth +slug: Web/API/Screen/pixelDepth +tags: + - API +translation_of: Web/API/Screen/pixelDepth +--- +<div>{{APIRef("CSSOM View")}}</div> + +<h2 id="Summary" name="Summary">概述</h2> + +<p>返回屏幕的位深度/色彩深度(bit depth)。根据CSSOM( CSS对象模型 )视图,为兼容起见,该值总为24。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox">depth = window.screen.pixelDepth +</pre> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush:js">// 如果没有足够的位深度/色彩深度(bit depth),就选择一个更纯的颜色 +if ( window.screen.pixelDepth > 8 ) { + document.style.color = "#FAEBD7"; +} else { + document.style.color = "#FFFFFF"; +} +</pre> + +<h2 id="Specification" name="Specification">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{ SpecName('CSSOM View', '#dom-screen-pixeldepth', 'Screen.pixelDepth') }}</td> + <td>{{ Spec2('CSSOM View') }}</td> + </tr> + </tbody> +</table> + +<h2 id="See_also" name="See_also">相关链接</h2> + +<ul> + <li>{{domxref("Screen.colorDepth")}}</li> +</ul> |
