* Injects dynamic CSS for syntax highlighting based on current editor theme
()
| 109 | * Injects dynamic CSS for syntax highlighting based on current editor theme |
| 110 | */ |
| 111 | function injectStyles() { |
| 112 | const themeId = settings?.value?.editorTheme || "one_dark"; |
| 113 | const config = getThemeConfig(themeId); |
| 114 | |
| 115 | // Code blocks need background, references panel uses parent's background |
| 116 | const codeBlockStyles = generateStyles(config, ".cm-highlighted", true); |
| 117 | const refPreviewStyles = generateStyles(config, ".ref-preview", false); |
| 118 | const allStyles = `${codeBlockStyles}\n${refPreviewStyles}`; |
| 119 | |
| 120 | if (!styleElement) { |
| 121 | styleElement = document.createElement("style"); |
| 122 | styleElement.id = "cm-static-highlight-styles"; |
| 123 | document.head.appendChild(styleElement); |
| 124 | } |
| 125 | |
| 126 | styleElement.textContent = allStyles; |
| 127 | currentThemeId = themeId; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Gets the language parser for a given URI using the modelist |
no test coverage detected