{"id":6586,"date":"2026-05-17T13:24:29","date_gmt":"2026-05-17T04:24:29","guid":{"rendered":"https:\/\/route-zero.com\/recruit\/?post_type=route&#038;p=6586"},"modified":"2026-11-17T13:24:40","modified_gmt":"2026-11-17T04:24:40","slug":"css-light-dark-color-scheme","status":"publish","type":"route","link":"https:\/\/route-zero.com\/recruit\/route\/6586\/","title":{"rendered":"CSS light-dark()\u3067\u30e9\u30a4\u30c8\/\u30c0\u30fc\u30af\u914d\u8272\u3092\u5207\u308a\u66ff\u3048\u308b"},"content":{"rendered":"<p>\u30e9\u30a4\u30c8\u30e2\u30fc\u30c9\u3068\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u3067\u6587\u5b57\u8272\u3084\u80cc\u666f\u8272\u3092\u5207\u308a\u66ff\u3048\u305f\u3044\u3068\u304d\u3001CSS\u306elight-dark()\u3092\u4f7f\u3046\u3068\u300e\u660e\u308b\u3044\u914d\u8272\u7528\u306e\u5024\u30fb\u6697\u3044\u914d\u8272\u7528\u306e\u5024\u300f\u30921\u3064\u306e\u5ba3\u8a00\u306b\u307e\u3068\u3081\u3089\u308c\u307e\u3059\u3002\u57fa\u672c\u306f:root\u306bcolor-scheme: light dark\u3092\u6307\u5b9a\u3057\u3001background\u3084color\u3078light-dark(\u660e\u308b\u3044\u5024, \u6697\u3044\u5024)\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002prefers-color-scheme\u306e\u30e1\u30c7\u30a3\u30a2\u30af\u30a8\u30ea\u304c\u4e0d\u8981\u306b\u306a\u308b\u5834\u9762\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u53e4\u3044\u30d6\u30e9\u30a6\u30b6\u30fc\u5411\u3051\u306b\u306f\u901a\u5e38\u306e\u8272\u3092\u5148\u306b\u66f8\u3044\u3066\u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u6b8b\u3057\u3066\u304a\u304f\u3068\u5b89\u5168\u3067\u3059\u3002<\/p>\n<h2>light-dark()\u3068\u306f\uff1f<\/h2>\n<p>light-dark()\u306f\u3001\u8981\u7d20\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30e0\u304clight\u306a\u30891\u3064\u76ee\u306e\u5024\u3001dark\u306a\u30892\u3064\u76ee\u306e\u5024\u3092\u9078\u3076CSS\u95a2\u6570\u3067\u3059\u3002\u8272\u3092\u5207\u308a\u66ff\u3048\u308b\u7528\u9014\u3067\u306flight-dark(\u30e9\u30a4\u30c8\u7528\u306e\u8272, \u30c0\u30fc\u30af\u7528\u306e\u8272)\u306e\u9806\u3067\u66f8\u304d\u307e\u3059\u3002<\/p>\n<blockquote>\n<p><strong>\u7528\u8a9e\u89e3\u8aac\uff1acolor-scheme<\/strong><br \/>\u30da\u30fc\u30b8\u3084\u8981\u7d20\u304c\u30e9\u30a4\u30c8\u7cfb\u30fb\u30c0\u30fc\u30af\u7cfb\u306e\u3069\u306e\u914d\u8272\u306b\u5bfe\u5fdc\u3059\u308b\u304b\u3092\u30d6\u30e9\u30a6\u30b6\u30fc\u3078\u4f1d\u3048\u308bCSS\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3059\u3002\u30d5\u30a9\u30fc\u30e0\u90e8\u54c1\u306a\u3069\u30d6\u30e9\u30a6\u30b6\u30fc\u5074\u306eUI\u8868\u73fe\u306b\u3082\u95a2\u4fc2\u3057\u307e\u3059\u3002<\/p>\n<\/blockquote>\n<pre><code>:root {\r\n  color-scheme: light dark;\r\n}\r\n\r\nbody {\r\n  background: light-dark(#ffffff, #111827);\r\n  color: light-dark(#1f2937, #f9fafb);\r\n}<\/code><\/pre>\n<hr>\n<h2>\u6700\u5c0f\u306e\u30e9\u30a4\u30c8\u30fb\u30c0\u30fc\u30af\u5207\u308a\u66ff\u3048\u3092\u4f5c\u308b<\/h2>\n<p>\u6700\u521d\u306f\u80cc\u666f\u8272\u3068\u6587\u5b57\u8272\u3060\u3051\u3092\u5207\u308a\u66ff\u3048\u308b\u3068\u4ed5\u7d44\u307f\u3092\u7406\u89e3\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002color-scheme: light dark\u3092\u6307\u5b9a\u3057\u305f\u3046\u3048\u3067\u3001\u540c\u3058\u8981\u7d20\u306e\u8272\u3092light-dark()\u3078\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<pre><code>&lt;main class=&quot;card&quot;&gt;\r\n  &lt;h2&gt;\u5b66\u7fd2\u30e1\u30e2&lt;\/h2&gt;\r\n  &lt;p&gt;CSS\u306e\u914d\u8272\u3092\u5207\u308a\u66ff\u3048\u3066\u307f\u3088\u3046\u3002&lt;\/p&gt;\r\n&lt;\/main&gt;<\/code><\/pre>\n<pre><code>:root {\r\n  color-scheme: light dark;\r\n}\r\n\r\n.card {\r\n  background-color: light-dark(#f8fafc, #1e293b);\r\n  color: light-dark(#0f172a, #f8fafc);\r\n  border: 1px solid light-dark(#cbd5e1, #475569);\r\n  padding: 1.5rem;\r\n  border-radius: 0.75rem;\r\n}<\/code><\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u30fc\u30fbOS\u5074\u3067\u9078\u3070\u308c\u305f\u30b9\u30ad\u30fc\u30e0\u306b\u5fdc\u3058\u3066\u3001card\u306e\u80cc\u666f\u30fb\u6587\u5b57\u30fb\u5883\u754c\u7dda\u304c\u540c\u3058\u30eb\u30fc\u30eb\u5185\u3067\u5207\u308a\u66ff\u308f\u308a\u307e\u3059\u3002<\/p>\n<hr>\n<h2>prefers-color-scheme\u3068\u306e\u9055\u3044<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u65b9\u6cd5<\/th>\n<th>\u66f8\u304d\u65b9<\/th>\n<th>\u5411\u3044\u3066\u3044\u308b\u5834\u9762<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>light-dark()<\/td>\n<td>1\u3064\u306eCSS\u5024\u306e\u4e2d\u306blight\/dark\u306e2\u5024\u3092\u66f8\u304f<\/td>\n<td>\u540c\u3058\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5024\u3060\u3051\u3092\u5207\u308a\u66ff\u3048\u305f\u3044<\/td>\n<\/tr>\n<tr>\n<td>@media (prefers-color-scheme)<\/td>\n<td>dark\u7528\u306e\u30eb\u30fc\u30eb\u7fa4\u3092\u5225\u30d6\u30ed\u30c3\u30af\u3067\u66f8\u304f<\/td>\n<td>\u30ec\u30a4\u30a2\u30a6\u30c8\u3084\u8907\u6570\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u307e\u3068\u3081\u3066\u5927\u304d\u304f\u5909\u66f4\u3057\u305f\u3044<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>light-dark()\u306f\u30e1\u30c7\u30a3\u30a2\u30af\u30a8\u30ea\u306e\u5b8c\u5168\u306a\u7f6e\u304d\u63db\u3048\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u8272\u306e\u5024\u3092\u30da\u30a2\u3067\u7ba1\u7406\u3057\u305f\u3044\u5834\u5408\u306f\u7c21\u6f54\u3067\u3059\u304c\u3001\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u6642\u3060\u3051\u5f71\u3092\u6d88\u3059\u3001\u753b\u50cf\u3092\u5dee\u3057\u66ff\u3048\u308b\u3001\u30ec\u30a4\u30a2\u30a6\u30c8\u3092\u5909\u3048\u308b\u306a\u3069\u8907\u6570\u306e\u30eb\u30fc\u30eb\u3092\u307e\u3068\u3081\u308b\u306a\u3089\u30e1\u30c7\u30a3\u30a2\u30af\u30a8\u30ea\u306e\u307b\u3046\u304c\u8aad\u307f\u3084\u3059\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<hr>\n<h2>CSS\u5909\u6570\u3068\u7d44\u307f\u5408\u308f\u305b\u308b<\/h2>\n<p>\u8272\u3092\u4f55\u5ea6\u3082\u76f4\u63a5\u66f8\u304f\u3088\u308a\u3001\u30ab\u30b9\u30bf\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u3078\u307e\u3068\u3081\u308b\u3068\u914d\u8272\u306e\u5f79\u5272\u304c\u5206\u304b\u308a\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002\u521d\u5fc3\u8005\u306e\u3046\u3061\u306f\u300e\u80cc\u666f\u300f\u300e\u6587\u5b57\u300f\u300e\u5f37\u8abf\u8272\u300f\u306e\u3088\u3046\u306b\u7528\u9014\u3067\u540d\u524d\u3092\u4ed8\u3051\u308b\u3068\u7ba1\u7406\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre><code>:root {\r\n  color-scheme: light dark;\r\n\r\n  --color-bg: light-dark(#ffffff, #0f172a);\r\n  --color-surface: light-dark(#f8fafc, #1e293b);\r\n  --color-text: light-dark(#111827, #f8fafc);\r\n  --color-accent: light-dark(#2563eb, #60a5fa);\r\n}\r\n\r\nbody {\r\n  background: var(--color-bg);\r\n  color: var(--color-text);\r\n}\r\n\r\na {\r\n  color: var(--color-accent);\r\n}<\/code><\/pre>\n<p>\u3042\u3068\u304b\u3089\u914d\u8272\u3092\u5909\u66f4\u3059\u308b\u3068\u304d\u306f\u5909\u6570\u306e\u5b9a\u7fa9\u3092\u4e2d\u5fc3\u306b\u898b\u76f4\u305b\u308b\u305f\u3081\u3001\u540c\u3058\u8272\u306e\u6307\u5b9a\u304c\u753b\u9762\u4e2d\u3078\u6563\u3089\u3070\u308a\u306b\u304f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u53e4\u3044\u30d6\u30e9\u30a6\u30b6\u30fc\u5411\u3051\u306e\u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af<\/h2>\n<p>MDN\u3067\u306f\u8272\u3068\u3057\u3066\u306elight-dark()\u3092Baseline 2024\u3068\u3057\u3066\u6848\u5185\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u53e4\u3044\u30d6\u30e9\u30a6\u30b6\u30fc\u3084\u7aef\u672b\u3067\u306f\u5229\u7528\u3067\u304d\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u3044\u74b0\u5883\u3067\u3082\u6587\u5b57\u304c\u8aad\u3081\u308b\u3088\u3046\u3001\u901a\u5e38\u306e\u8272\u3092\u5148\u306b\u6307\u5b9a\u3057\u3066\u304b\u3089light-dark()\u3092\u4e0a\u66f8\u304d\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code>:root {\r\n  color-scheme: light dark;\r\n}\r\n\r\nbody {\r\n  background: #ffffff;\r\n  color: #1f2937;\r\n\r\n  background: light-dark(#ffffff, #111827);\r\n  color: light-dark(#1f2937, #f9fafb);\r\n}<\/code><\/pre>\n<p>light-dark()\u3092\u89e3\u91c8\u3067\u304d\u306a\u3044\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u306f\u3001\u305d\u306e\u5ba3\u8a00\u304c\u63a1\u7528\u3055\u308c\u305a\u3001\u5148\u306b\u66f8\u3044\u305f\u901a\u5e38\u306e\u8272\u304c\u6b8b\u308b\u69cb\u6210\u3092\u72d9\u3048\u307e\u3059\u3002\u5b9f\u969b\u306e\u5bfe\u8c61\u30d6\u30e9\u30a6\u30b6\u30fc\u3067\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u898b\u305f\u76ee\u3060\u3051\u3067\u306a\u304f\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3082\u78ba\u8a8d\u3059\u308b<\/h2>\n<p>\u30e9\u30a4\u30c8\u7528\u3068\u30c0\u30fc\u30af\u7528\u306b2\u8272\u3092\u7528\u610f\u3057\u3066\u3082\u3001\u6587\u5b57\u3068\u80cc\u666f\u306e\u7d44\u307f\u5408\u308f\u305b\u304c\u8aad\u307f\u306b\u304f\u3051\u308c\u3070\u826f\u3044\u914d\u8272\u3068\u306f\u8a00\u3048\u307e\u305b\u3093\u3002\u7279\u306b\u30ea\u30f3\u30af\u3001\u30dc\u30bf\u30f3\u3001\u88dc\u52a9\u30c6\u30ad\u30b9\u30c8\u306f\u4e21\u65b9\u306e\u30b9\u30ad\u30fc\u30e0\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30e9\u30a4\u30c8\u30e2\u30fc\u30c9\u3067\u6587\u5b57\u3068\u80cc\u666f\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<li>\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u3067\u3082\u540c\u3058\u8981\u7d20\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<li>\u30ea\u30f3\u30af\u304c\u901a\u5e38\u30c6\u30ad\u30b9\u30c8\u3068\u533a\u5225\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<li>hover\u3084focus\u6642\u306e\u8272\u3082\u4e21\u30b9\u30ad\u30fc\u30e0\u3067\u898b\u843d\u3068\u3055\u306a\u3044\u3002<\/li>\n<li>\u8272\u3060\u3051\u3067\u72b6\u614b\u3084\u30a8\u30e9\u30fc\u3092\u4f1d\u3048\u306a\u3044\u3002<\/li>\n<\/ul>\n<p>CSS Color Level 5\u306e\u4ed5\u69d8\u4f8b\u3067\u3082\u3001light-dark()\u3092\u4f7f\u3063\u3066\u30e9\u30a4\u30c8\u30fb\u30c0\u30fc\u30af\u305d\u308c\u305e\u308c\u3067\u8aad\u307f\u3084\u3059\u3044\u30ea\u30f3\u30af\u8272\u3092\u9078\u3076\u4f8b\u304c\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u5207\u308a\u66ff\u308f\u3089\u306a\u3044\u3068\u304d\u306e\u78ba\u8a8d\u30dd\u30a4\u30f3\u30c8<\/h2>\n<ul>\n<li>:root\u3084\u5bfe\u8c61\u8981\u7d20\u3067color-scheme: light dark\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u304b\u3002<\/li>\n<li>OS\u3084\u30d6\u30e9\u30a6\u30b6\u30fc\u306e\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30e0\u8a2d\u5b9a\u304c\u60f3\u5b9a\u3069\u304a\u308a\u304b\u3002<\/li>\n<li>\u5f8c\u308d\u306eCSS\u3067background\u3084color\u304c\u4e0a\u66f8\u304d\u3055\u308c\u3066\u3044\u306a\u3044\u304b\u3002<\/li>\n<li>\u30d6\u30e9\u30a6\u30b6\u30fc\u304clight-dark()\u3078\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u304b\u3002<\/li>\n<li>CSS\u5909\u6570\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u5909\u6570\u540d\u306e\u30b9\u30da\u30eb\u3068\u9069\u7528\u7bc4\u56f2\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/li>\n<\/ul>\n<p>\u307e\u305a1\u8981\u7d20\u3060\u3051\u306b\u76f4\u63a5light-dark()\u3092\u66f8\u3044\u3066\u6319\u52d5\u3092\u78ba\u8a8d\u3057\u3001\u52d5\u3044\u305f\u3089CSS\u5909\u6570\u3078\u6574\u7406\u3059\u308b\u3068\u3001\u539f\u56e0\u3092\u5207\u308a\u5206\u3051\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u3088\u304f\u3042\u308b\u8cea\u554f\u3068\u307e\u3068\u3081<\/h2>\n<h3>light-dark()\u3060\u3051\u66f8\u3051\u3070\u81ea\u52d5\u3067\u30c0\u30fc\u30af\u30e2\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u304b\uff1f<\/h3>\n<p>\u5024\u306e\u9078\u629e\u306f\u8981\u7d20\u306e\u30ab\u30e9\u30fc\u30b9\u30ad\u30fc\u30e0\u306b\u57fa\u3065\u304d\u307e\u3059\u3002\u57fa\u672c\u4f8b\u3067\u306fcolor-scheme: light dark\u3082\u5408\u308f\u305b\u3066\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<h3>prefers-color-scheme\u306f\u3082\u3046\u4e0d\u8981\u3067\u3059\u304b\uff1f<\/h3>\n<p>\u4e0d\u8981\u306b\u306a\u308b\u5834\u9762\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u30c0\u30fc\u30af\u6642\u3060\u3051\u8907\u6570\u306e\u30eb\u30fc\u30eb\u3084\u69cb\u9020\u7684\u306a\u5909\u66f4\u3092\u307e\u3068\u3081\u305f\u3044\u5834\u5408\u306f\u30e1\u30c7\u30a3\u30a2\u30af\u30a8\u30ea\u304c\u9069\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>CSS\u5909\u6570\u306e\u4e2d\u3067\u3082\u4f7f\u3048\u307e\u3059\u304b\uff1f<\/h3>\n<p>\u4f7f\u3048\u307e\u3059\u3002\u80cc\u666f\u30fb\u6587\u5b57\u30fb\u5f37\u8abf\u8272\u306a\u3069\u306e\u5f79\u5272\u3054\u3068\u306b\u30ab\u30b9\u30bf\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3\u3078\u307e\u3068\u3081\u308b\u3068\u7ba1\u7406\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>light-dark()\u306f\u3001\u30e9\u30a4\u30c8\u30fb\u30c0\u30fc\u30af\u3067\u5909\u308f\u308b\u8272\u30921\u304b\u6240\u306b\u307e\u3068\u3081\u308b\u305f\u3081\u306e\u9078\u629e\u80a2\u3067\u3059\u3002\u307e\u305a\u80cc\u666f\u3068\u6587\u5b57\u306e2\u8272\u304b\u3089\u8a66\u3057\u3001\u4e21\u30e2\u30fc\u30c9\u306e\u30b3\u30f3\u30c8\u30e9\u30b9\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u914d\u8272\u5909\u6570\u3078\u5e83\u3052\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"featured_media":6587,"template":"","_links":{"self":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route\/6586"}],"collection":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/route"}],"about":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/types\/route"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media\/6587"}],"wp:attachment":[{"href":"https:\/\/route-zero.com\/recruit\/wp-json\/wp\/v2\/media?parent=6586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}