Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> JavaScript

Cách trả về số bit dùng để hiển thị một màu trên màn hình trong JavaScript?

Sử dụng screen.colorDepth để lấy số bit trên pixel dùng để hiển thị màu (thường bằng pixelDepth).

Ví dụ

<!DOCTYPE html>
<html>
  <body>
    <script>
      document.write("Chiều rộng màn hình: " + screen.width);
      document.write("<br>Chiều cao màn hình: " + screen.height);
      document.write("<br>Độ sâu màu: " + screen.colorDepth);
    </script>
  </body>
</html>