Skip to content

Select for BS5 does not handle table variants #1

Open

Description

@large

When using BS5 table variants like "table-light", "table-dark" etc select does not draw/coloring as expected.
See example http://live.datatables.net/huhaciwu/1/edit (with and without table variant enable)

Default BS5 sets the --bs-table-bg: transparent, but when you use "table-light" then coloring is --bs-table-bg: #f8f9fa;

Tried to put "!important" behind the coloring of "background-color" in the select.css, without any effect.

Note on variants: https://getbootstrap.com/docs/5.0/content/tables/
This is what happens behind the "scenes".

@mixin table-variant($state, $background) {
  .table-#{$state} {
    $color: color-contrast(opaque($body-bg, $background));
    $hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
    $striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
    $active-bg: mix($color, $background, percentage($table-active-bg-factor));

    --#{$variable-prefix}table-bg: #{$background};
    --#{$variable-prefix}table-striped-bg: #{$striped-bg};
    --#{$variable-prefix}table-striped-color: #{color-contrast($striped-bg)};
    --#{$variable-prefix}table-active-bg: #{$active-bg};
    --#{$variable-prefix}table-active-color: #{color-contrast($active-bg)};
    --#{$variable-prefix}table-hover-bg: #{$hover-bg};
    --#{$variable-prefix}table-hover-color: #{color-contrast($hover-bg)};

    color: $color;
    border-color: mix($color, $background, percentage($table-border-factor));
  }
}

Activity

  1. AllanJard commented on Jul 28, 2021

    @AllanJard
    Contributor

    Hi - thanks for posting this question. You are right - at the moment we don't take into account Bootstrap 5 table variants and variables yet. It is something I plan to support in future.

  2. large commented on Jul 28, 2021

    @large
    Author

    Good to know... I saw a simular question here, where you created a fix 😁 https://datatables.net/forums/discussion/68683/datatables-1-10-25-breaks-table-striped

    I am no expert in cscc, but I guess the solution are the direction of your fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions