Resolve the inline word-diff background, strengthening theme colors that are too subtle to see.
(kind: SplitLineCell["kind"], theme: AppTheme)
| 302 | |
| 303 | /** Resolve the inline word-diff background, strengthening theme colors that are too subtle to see. */ |
| 304 | function wordDiffHighlightBg(kind: SplitLineCell["kind"], theme: AppTheme) { |
| 305 | const cacheKey = [themeRenderCacheKey(theme), theme.contextContentBg, theme.panelAlt].join(":"); |
| 306 | let cached = wordDiffBackgroundCache.get(cacheKey); |
| 307 | if (!cached) { |
| 308 | const addition = resolveWordDiffHighlightBg( |
| 309 | theme.addedContentBg, |
| 310 | theme.addedBg, |
| 311 | theme.addedSignColor, |
| 312 | ); |
| 313 | const deletion = resolveWordDiffHighlightBg( |
| 314 | theme.removedContentBg, |
| 315 | theme.removedBg, |
| 316 | theme.removedSignColor, |
| 317 | ); |
| 318 | |
| 319 | cached = { |
| 320 | addition, |
| 321 | context: theme.contextContentBg, |
| 322 | deletion, |
| 323 | empty: theme.panelAlt, |
| 324 | }; |
| 325 | wordDiffBackgroundCache.set(cacheKey, cached); |
| 326 | } |
| 327 | |
| 328 | return cached[kind]; |
| 329 | } |
| 330 | |
| 331 | /** Remap Pierre token hues that collide with diff add/remove semantics into theme-safe syntax colors. */ |
| 332 | function normalizeHighlightedColor(color: string | undefined, theme: AppTheme) { |
no test coverage detected