Row striping customization - Request: add --dt-row-stripe-alpha var instead of 0.023 hard code

Row striping customization - Request: add --dt-row-stripe-alpha var instead of 0.023 hard code

ds00424ds00424 Posts: 10Questions: 4Answers: 0

Hi there.
I'm migrating from DT v1.13.4 to DT v2.1.3.
I have an overriding CSS file that in v1 (among other things) sets the stripe color for odd row class. This worked well.
I see in v2 DT is now using Nth child as well as box-shadow with rgba() to do the row striping for table.dataTable.stripe. Nicely, the rgb color is a css variable that I can override. But the alpha value looks hard coded to 0.023 - which in my case, is too transparent.

I have overridden the complete Nth child css rule to get the stripe color I want.
But it would be nice if the DT css rule had the alpha value also as a css variable.
Then I could simply override the --dt-row-stripe variable as well as the --dt-row-stripe-alpha variable.

If I'm missing some alternative solution in the current DT v2 css, please advise.

Thanks.

Answers

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin

    So at the moment it can't be modified via a CSS variable, but it can with a SCSS variable at build time. This is the source code in question.

    Probably is a good idea to make that a CSS variable as well - I just need to figure out a backwards compatible way of doing it!

    Added to the todo list :)

    Allan

  • ds00424ds00424 Posts: 10Questions: 4Answers: 0

    Thanks!
    FYI, I see some other places with variable color but hardcoded alpha.
    (eg: hover)
    Perhaps those can be considered as well.

    David

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin

    Yeah, I was thinking about them. The problem is they are all linked. calc might help, or perhaps it just has to be a bit long list, but the real difficulty will be backwards compatibility I reckon.

    Allan

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin

    Hi,

    I've committed a change for this which will be in DataTables 2.2. Specifically --dt-row-stripe-alpha is the new variable of interest here. It only works with the DataTables default styling. Bootstrap extra have their own way of doing this.

    Allan

Sign In or Register to comment.