Improve editor, plugin updates, and window transfers for 0.1.41
This commit is contained in:
@@ -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