feat: markcss

This commit is contained in:
Felix Roos 2024-10-22 22:23:48 +02:00
parent dd696ba663
commit 1e6e0a61b3
2 changed files with 5 additions and 2 deletions

View file

@ -13,7 +13,7 @@ import {
lineNumbers, lineNumbers,
drawSelection, drawSelection,
} from '@codemirror/view'; } from '@codemirror/view';
import { Pattern, repl } from '@strudel/core'; import { repl, registerControl } from '@strudel/core';
import { Drawer, cleanupDraw } from '@strudel/draw'; import { Drawer, cleanupDraw } from '@strudel/draw';
import { isAutoCompletionEnabled } from './autocomplete.mjs'; import { isAutoCompletionEnabled } from './autocomplete.mjs';
import { isTooltipEnabled } from './tooltip.mjs'; import { isTooltipEnabled } from './tooltip.mjs';
@ -354,3 +354,5 @@ function s4() {
.toString(16) .toString(16)
.substring(1); .substring(1);
} }
export const markcss = registerControl('markcss');

View file

@ -93,6 +93,7 @@ const miniLocationHighlights = EditorView.decorations.compute([miniLocations, vi
if (haps.has(id)) { if (haps.has(id)) {
const hap = haps.get(id); const hap = haps.get(id);
const color = hap.value?.color ?? 'var(--foreground)'; const color = hap.value?.color ?? 'var(--foreground)';
const style = hap.value?.markcss || `outline: solid 2px ${color}`;
// Get explicit channels for color values // Get explicit channels for color values
/* /*
const swatch = document.createElement('div'); const swatch = document.createElement('div');
@ -114,7 +115,7 @@ const miniLocationHighlights = EditorView.decorations.compute([miniLocations, vi
to, to,
Decoration.mark({ Decoration.mark({
// attributes: { style: `outline: solid 2px rgba(${channels.join(', ')})` }, // attributes: { style: `outline: solid 2px rgba(${channels.join(', ')})` },
attributes: { style: `outline: solid 2px ${color}` }, attributes: { style },
}), }),
); );
} }