@@ -17,14 +17,16 @@ export function generateDecorations(
1717 const { domainRanges, targetRanges } = getRanges ( fixture , rangeType ) ;
1818
1919 const codeLineRanges = getCodeLineRanges ( fixture . code ) ;
20+ const colors = getColors ( rangeType ) ;
21+
2022 const domainDecorations = getDecorations ( codeLineRanges , domainRanges ) ;
2123 const targetRangeDecorations = getDecorations ( codeLineRanges , targetRanges ) ;
2224
2325 const domainHighlights = domainDecorations . map ( ( d ) =>
24- getHighlights ( highlightColors . domain , d . range , d . style ) ,
26+ getHighlights ( colors . domain , d . range , d . style ) ,
2527 ) ;
2628 const targetRangeHighlights = targetRangeDecorations . map ( ( d ) =>
27- getHighlights ( getTargetRangeColor ( rangeType ) , d . range , d . style ) ,
29+ getHighlights ( colors . target , d . range , d . style ) ,
2830 ) ;
2931
3032 const highlights = flattenHighlights ( [
@@ -35,10 +37,14 @@ export function generateDecorations(
3537 return highlightsToDecorations ( highlights ) ;
3638}
3739
38- function getTargetRangeColor ( rangeType : RangeType ) : RangeTypeColors {
39- return rangeType === "content"
40- ? highlightColors . content
41- : highlightColors . removal ;
40+ function getColors ( rangeType : RangeType ) {
41+ return {
42+ domain : highlightColors . domain ,
43+ target :
44+ rangeType === "content"
45+ ? highlightColors . content
46+ : highlightColors . removal ,
47+ } ;
4248}
4349
4450function getRanges ( fixture : Fixture , rangeType : RangeType ) {
0 commit comments