MCPcopy Create free account
hub / github.com/modem-dev/hunk / wordDiffHighlightBg

Function wordDiffHighlightBg

src/ui/diff/pierre.ts:304–329  ·  view source on GitHub ↗

Resolve the inline word-diff background, strengthening theme colors that are too subtle to see.

(kind: SplitLineCell["kind"], theme: AppTheme)

Source from the content-addressed store, hash-verified

302
303/** Resolve the inline word-diff background, strengthening theme colors that are too subtle to see. */
304function 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. */
332function normalizeHighlightedColor(color: string | undefined, theme: AppTheme) {

Callers 2

makeSplitCellFunction · 0.85
makeStackCellFunction · 0.85

Calls 2

themeRenderCacheKeyFunction · 0.85

Tested by

no test coverage detected