pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

Can't set selection box color through global theming

Open DanielSidhion opened this issue 2 years ago • 0 comments

I've been trying to set the selection box color using the global theming structure as described here.

However, it looks like the selection box color is always overridden by Svelvet:

  • The Svelvet component defines a selectionColor here, which gets passed to Graph.
  • selectionColor ends up passed to SelectionBox. Even though SelectionBox allows its color to be null, neither Svelvet nor Graph allow that, so an actual value will end up getting passed.
  • SelectionBox's color property ends up used in --prop-selection-box-color here, and that takes precedence over the --selection-box-color property suggested by the styling guide on Svelvet's website.

Basically, this means that the only way to properly customize the selection box color is by passing it through a prop. I'd like to avoid that, as I'm using Tailwind CSS in my project, and I'd like to just use the values from Tailwind like the following:

:root[svelvet-theme='my-custom-theme'] {
    --selection-box-color: theme(colors.purple.500);
}

theme() is a Tailwind construct that pulls the value straight from the Tailwind theme. I could just figure out what value it is that I'm currently using and copy that value in Svelvet's selectionColor prop, but whenever I change the color in my project, I'll have to remember to also update the prop.

Do you folks have any suggestion on how to fix this? I'm willing to submit a PR, but I'd like to know if there's a preferred way to solve this. My suggestion would be either changing the precedence order here and here to consider --seelction-box-color first, or allow undefined or null in Svelvet and Graph's selectionColor prop.

DanielSidhion avatar Jul 25 '23 04:07 DanielSidhion