/* 表示用户设定了浅色主题时,页面背景色为白色 */
@media (prefers-color-scheme: light) {
  body { 
    background: white; 
  }
}

/* 表示用户设定了暗色主题时,页面背景色为黑色 */
@media (prefers-color-scheme: dark) {
  body { 
    background: black; 
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.