Skip to content

Commit 9c12978

Browse files
committed
fix: better band cursor opacity
1 parent 27577cd commit 9c12978

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/Cursors.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ type ResolvedCursorOptions = TSTB.Object.Required<
2020

2121
//
2222

23-
const getLineBackgroundColor = (dark?: boolean) =>
24-
dark ? 'rgba(255,255,255,.3)' : 'rgba(0, 26, 39, 0.3)'
23+
const getLineBackgroundColor = (dark: boolean, bandWidth: number) =>
24+
dark
25+
? `rgba(255,255,255,${bandWidth > 4 ? 0.15 : 0.3})`
26+
: `rgba(0, 26, 39, ${bandWidth > 4 ? 0.15 : 0.3})`
2527

2628
const getBackgroundColor = (dark?: boolean) =>
2729
dark ? 'rgba(255,255,255,.9)' : 'rgba(0, 26, 39, 0.9)'
@@ -311,7 +313,10 @@ function Cursor<TDatum>(props: {
311313
position: 'absolute',
312314
top: 0,
313315
left: 0,
314-
background: getLineBackgroundColor(getOptions().dark),
316+
background: getLineBackgroundColor(
317+
getOptions().dark ?? false,
318+
bandWidth
319+
),
315320
}}
316321
/>
317322
) : null}

0 commit comments

Comments
 (0)