Improve editor, plugin updates, and window transfers for 0.1.41
This commit is contained in:
@@ -176,6 +176,7 @@
|
||||
.preview-function{color:var(--rs-syntax-function,var(--rs-accent-2))}
|
||||
.preview-number{color:var(--rs-syntax-number,var(--rs-special))}
|
||||
.overlay-controls{display:flex;align-items:center;flex-wrap:wrap;gap:var(--rs-settings-gap);max-width:100%}
|
||||
.overlay-controls output{width:4ch;flex:0 0 4ch;text-align:right;font-variant-numeric:tabular-nums}
|
||||
.overlay-controls input[type=range]{width:160px;max-width:100%;min-width:0}
|
||||
input[type=checkbox]{accent-color:var(--rs-accent)}
|
||||
.overlay-controls input[type=range]{appearance:none;background:transparent;height:var(--rs-settings-control-height);margin:0;cursor:pointer}
|
||||
|
||||
@@ -107,7 +107,7 @@ export function applyTransparency(value: Appearance['transparency'], root: HTMLE
|
||||
root.style.setProperty('--rs-surface-opacity', `${100 - amount}%`);
|
||||
root.style.setProperty('--rs-editor-surface-opacity', `${100 - amount * 10 / 18}%`);
|
||||
root.style.setProperty('--rs-hover-surface-opacity', `${100 - amount * 8 / 18}%`);
|
||||
root.style.setProperty('--rs-transparent-plugin-bg', amount ? 'transparent' : 'var(--rs-bg)');
|
||||
root.style.setProperty('--rs-transparent-plugin-bg', 'transparent');
|
||||
}
|
||||
const backgroundUrls = new WeakMap<HTMLElement, { image: string; url: string }>();
|
||||
const backgroundRequests = new WeakMap<HTMLElement, string | undefined>();
|
||||
@@ -194,6 +194,13 @@ export function applyAppearance(value: Appearance, root = document.documentEleme
|
||||
for (const [key, color] of Object.entries(characterSyntax(theme))) root.style.setProperty(`--rs-${key}`, color);
|
||||
root.style.setProperty('--rs-danger', 'var(--rs-error)');
|
||||
if (custom) for (const [key, color] of Object.entries(custom.colors)) root.style.setProperty(`--rs-${key}`, color);
|
||||
// Keep the theme hue while exposing the background beneath selected text.
|
||||
const selection = root.style.getPropertyValue('--rs-selection').trim().slice(1);
|
||||
const fullSelection = selection.length <= 4 ? [...selection].map(part => part + part).join('') : selection;
|
||||
if (/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(fullSelection)) {
|
||||
const alpha = Math.min(166, fullSelection.length === 8 ? parseInt(fullSelection.slice(6), 16) : 255);
|
||||
root.style.setProperty('--rs-selection', `#${fullSelection.slice(0, 6)}${alpha.toString(16).padStart(2, '0')}`);
|
||||
}
|
||||
window.dispatchEvent(new CustomEvent('runestone-theme-changed'));
|
||||
}
|
||||
export function saveAppearance(value: Appearance) {
|
||||
|
||||
Reference in New Issue
Block a user