diff --git a/templates/partials/bottom-scripts.html b/templates/partials/bottom-scripts.html index 1c05c9a..1ada986 100644 --- a/templates/partials/bottom-scripts.html +++ b/templates/partials/bottom-scripts.html @@ -5,6 +5,42 @@ document.querySelectorAll("pre code").forEach(block => { window.hljs.highlightBlock(block); }); + + // Get the computed style of the root element (usually :root in CSS) + const rootStyle = getComputedStyle(document.documentElement); + + // Function to update the display element with the CSS variable value, preserving inner span + function updateDisplayElementPreservingSpan(cssVariable, displayElementId) { + const value = rootStyle.getPropertyValue(cssVariable).trim(); + const displayElement = document.getElementById(displayElementId); + if (displayElement) { + // Preserve the inner span if it exists + const spanElement = displayElement.querySelector('.color-preview'); + if (spanElement) { + displayElement.innerHTML = `${value}`; + } else { + displayElement.textContent = value; + } + } + } + // Update each display element with its corresponding CSS variable value + updateDisplayElementPreservingSpan('--global-font-size', 'css-global-font-size'); + updateDisplayElementPreservingSpan('--global-line-height', 'css-global-line-height'); + updateDisplayElementPreservingSpan('--global-space', 'css-global-space'); + updateDisplayElementPreservingSpan('--font-stack', 'css-font-stack'); + updateDisplayElementPreservingSpan('--mono-font-stack', 'css-mono-font-stack'); + updateDisplayElementPreservingSpan('--background-color', 'css-background-color'); + updateDisplayElementPreservingSpan('--font-color', 'css-font-color'); + updateDisplayElementPreservingSpan('--invert-font-color', 'css-invert-font-color'); + updateDisplayElementPreservingSpan('--primary-color', 'css-primary-color'); + updateDisplayElementPreservingSpan('--secondary-color', 'css-secondary-color'); + updateDisplayElementPreservingSpan('--error-color', 'css-error-color'); + updateDisplayElementPreservingSpan('--progress-bar-background', 'css-progress-bar-background'); + updateDisplayElementPreservingSpan('--progress-bar-fill', 'css-progress-bar-fill'); + updateDisplayElementPreservingSpan('--code-bg-color', 'css-code-bg-color'); + updateDisplayElementPreservingSpan('--block-background-color', 'css-block-background-color'); + updateDisplayElementPreservingSpan('--input-style', 'css-input-style'); + updateDisplayElementPreservingSpan('--display-h1-decoration', 'css-display-h1-decoration'); }); diff --git a/templates/partials/documentation.html b/templates/partials/documentation.html index bd5a46b..0264212 100644 --- a/templates/partials/documentation.html +++ b/templates/partials/documentation.html @@ -25,57 +25,66 @@ margin-right: 4px; } +
15px
)15px
)1.4em
)1.4em
)10px
)@font-face
or any other font provider to include your custom fonts."Menlo", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", serif
)"Menlo", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", serif
)code
."Menlo", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", serif
)"Menlo", "Monaco", "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", serif
)#fff
)#fff
)#151515
)#151515
)#fff
)#fff
)#1a95e0
)#1a95e0
)#727578
)#727578
)#d20962
)#d20962
)#727578
)#727578
)#151515
)#151515
)<code>
elements.#e8eff2
)#e8eff2
)<pre>
elements. Also applies to <code>
elements inside a <pre>
element.#fff
)solid
)h1
elements. Possible values are:none
)<pre>
elements. Also applies to <code>
elements inside a <pre>