Changeset 34076d7 in Klonkt
- Timestamp:
- 06/24/2026 05:17:00 PM (3 months ago)
- Branches:
- main
- Children:
- dd856db
- Parents:
- c9c70cc
- File:
-
- 1 edited
-
src/views/pages/admin-site-edit.ejs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/pages/admin-site-edit.ejs
rc9c70cc r34076d7 121 121 <% palettes.forEach(function(p) { %> 122 122 <label class="palette-swatch"> 123 <input type="radio" name="palette" value="<%= p.key %>" <%= (site.palette || ' sage') === p.key ? 'checked' : '' %>>123 <input type="radio" name="palette" value="<%= p.key %>" <%= (site.palette || 'klonkt') === p.key ? 'checked' : '' %>> 124 124 <span class="palette-preview" aria-hidden="true"> 125 125 <span class="pp-half pp-light" style="background: <%= p.light.paper %>; color: <%= p.light.ink %>;"> … … 137 137 </fieldset> 138 138 </fieldset> 139 140 <%# Live preview: selecting an accent / theme / palette re-themes this page 141 instantly (reverts on reload; persists on save). %> 142 <script> 143 (function(){ 144 if (window.__themePreviewWired) return; window.__themePreviewWired = true; 145 var html = document.documentElement; 146 function applyAccent(hex){ 147 if(!/^#[0-9a-fA-F]{6}$/.test(hex)) return; 148 var sa = document.getElementById('pcms-site-accent'); 149 if(!sa){ sa = document.createElement('style'); sa.id = 'pcms-site-accent'; document.head.appendChild(sa); } 150 sa.textContent = ':root,[data-palette]{--accent:'+hex+';--accent-soft:color-mix(in srgb,'+hex+' 80%,white);--accent-tint:color-mix(in srgb,'+hex+' 12%,transparent);}'; 151 } 152 document.addEventListener('change', function(e){ 153 var t = e.target; if(!t || !t.name) return; 154 if(t.name === 'palette'){ html.setAttribute('data-palette', t.value); } 155 else if(t.name === 'accent'){ applyAccent(t.value); } 156 else if(t.name === 'theme_override'){ 157 if(t.value === 'light' || t.value === 'dark'){ html.setAttribute('data-theme', t.value); } 158 else { var dk = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; html.setAttribute('data-theme', dk ? 'dark' : 'light'); } 159 } 160 }); 161 })(); 162 </script> 139 163 140 164 <fieldset>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)