Skip to content

Commit 0a89eaa

Browse files
committed
fix(app): restore type popover theme
1 parent bd0de86 commit 0a89eaa

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎app/src/lib/editor/hover.ts‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ const inset = 8
2424
/** The notch's own side, before it is turned onto its corner. */
2525
const notch = 7
2626

27+
/** Palette values that a body-portaled hover no longer inherits from the editor. */
28+
const palette = [
29+
'--mark-add',
30+
'--mark-remove',
31+
'--window-background',
32+
'--window-border',
33+
'--window-foreground',
34+
'--window-surface',
35+
] as const
36+
2737
const mark = Decoration.mark({ class: 'twoslash-mark' })
2838

2939
/**
@@ -113,8 +123,13 @@ export const hover: Extension = [
113123
let surface = draw(view.state)
114124
const root = bridge(surface)
115125
const frame = view.dom.closest<HTMLElement>('[data-frame-window]')
116-
if (frame)
126+
if (frame) {
117127
root.style.setProperty('--twoslash-hover-max-width', `${frame.clientWidth - reach}px`)
128+
const theme = getComputedStyle(view.dom)
129+
root.style.color = theme.color
130+
for (const property of palette)
131+
root.style.setProperty(property, theme.getPropertyValue(property))
132+
}
118133
/**
119134
* Aligns the notch with the identifier after viewport-constrained placement.
120135
*/

0 commit comments

Comments
 (0)