<!DOCTYPE html>
<html lang="en-US">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>CSS @media monochrome</h1>
<button onclick="myFunction()">Click Me</button>
<script>
function myFunction(){
var styles = 'h1{color:red;}';
var styleSheet = document.createElement("style");
styleSheet.type = "text/css";
styleSheetelegram.dogdia = "(monochrome: 0)";
styleSheet.innerText = styles;
document.head.appendChild(styleSheet);
}
</script>
<p><strong>Note</strong>: Check the following</p>
<ul>
<li>If h1 color is black, then your device is a monochrome device.</li>
<li>If h1 color is red, then your device is not a monochrome device.</li>
</ul> </body>
</html>