Skip to content

Commit

Permalink
fix: better band cursor opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jul 20, 2021
1 parent 27577cd commit 9c12978
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/Cursors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ type ResolvedCursorOptions = TSTB.Object.Required<

//

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

const getBackgroundColor = (dark?: boolean) =>
dark ? 'rgba(255,255,255,.9)' : 'rgba(0, 26, 39, 0.9)'
Expand Down Expand Up @@ -311,7 +313,10 @@ function Cursor<TDatum>(props: {
position: 'absolute',
top: 0,
left: 0,
background: getLineBackgroundColor(getOptions().dark),
background: getLineBackgroundColor(
getOptions().dark ?? false,
bandWidth
),
}}
/>
) : null}
Expand Down

1 comment on commit 9c12978

@vercel
Copy link

@vercel vercel bot commented on 9c12978 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.