|
61 | 61 | .options > * { |
62 | 62 | margin-left: 8px; |
63 | 63 | } |
| 64 | + |
| 65 | + /* Dark mode: simulates theme where union/oneOf buttons use transparent/inherit */ |
| 66 | + body.dark-mode { |
| 67 | + background-color: #1e1e1e !important; |
| 68 | + color: #e0e0e0; |
| 69 | + } |
| 70 | + body.dark-mode header { |
| 71 | + background-color: #2d2d2d; |
| 72 | + --iron-icon-fill-color: #e0e0e0; |
| 73 | + --paper-input-container-focus-color: #90caf9; |
| 74 | + --paper-input-container-label: { color: #e0e0e0; }; |
| 75 | + } |
| 76 | + body.dark-mode [role="main"] { |
| 77 | + background-color: #1e1e1e; |
| 78 | + } |
| 79 | + .dark-mode-toggle { |
| 80 | + position: fixed; |
| 81 | + bottom: 12px; |
| 82 | + right: 12px; |
| 83 | + z-index: 9999; |
| 84 | + padding: 6px 10px; |
| 85 | + background: #333; |
| 86 | + color: #fff; |
| 87 | + border-radius: 4px; |
| 88 | + font-size: 12px; |
| 89 | + cursor: pointer; |
| 90 | + box-shadow: 0 2px 8px rgba(0,0,0,0.3); |
| 91 | + } |
| 92 | + .dark-mode-toggle input { margin-right: 6px; } |
64 | 93 | </style> |
65 | 94 | </head> |
66 | 95 |
|
67 | 96 | <body> |
68 | 97 | <div id="demo"></div> |
| 98 | + <label class="dark-mode-toggle" title="Toggle dark mode to verify union/oneOf button visibility"> |
| 99 | + <input type="checkbox" id="darkModeCheckbox" /> Dark mode |
| 100 | + </label> |
69 | 101 |
|
70 | 102 | <script type="module" src="index.js"></script> |
71 | 103 |
|
72 | 104 | <script> |
| 105 | + (function() { |
| 106 | + function initDarkMode() { |
| 107 | + var cb = document.getElementById('darkModeCheckbox'); |
| 108 | + var stored = localStorage.getItem('api-type-document-dark-mode') === 'true'; |
| 109 | + if (stored) { |
| 110 | + document.body.classList.add('dark-mode'); |
| 111 | + if (cb) cb.checked = true; |
| 112 | + } |
| 113 | + if (cb) { |
| 114 | + cb.addEventListener('change', function() { |
| 115 | + document.body.classList.toggle('dark-mode', cb.checked); |
| 116 | + localStorage.setItem('api-type-document-dark-mode', cb.checked); |
| 117 | + }); |
| 118 | + } |
| 119 | + } |
| 120 | + if (document.readyState === 'loading') { |
| 121 | + document.addEventListener('DOMContentLoaded', initDarkMode); |
| 122 | + } else { |
| 123 | + initDarkMode(); |
| 124 | + } |
| 125 | + })(); |
73 | 126 | document.addEventListener('WebComponentsReady', function() { |
74 | 127 | if (!window.ShadyCSS) { |
75 | 128 | return; |
|
0 commit comments