Add bs prefix

This commit is contained in:
Martijn Cuppens 2020-04-15 14:54:25 +02:00
parent d089a683c8
commit eed27f35cc
3 changed files with 27 additions and 27 deletions

View File

@ -3,14 +3,14 @@
//
.table {
--table-bg: #{$table-bg};
--table-accent-bg: transparent;
--table-striped-color: #{$table-striped-color};
--table-striped-bg: #{$table-striped-bg};
--table-active-color: #{$table-active-color};
--table-active-bg: #{$table-active-bg};
--table-hover-color: #{$table-hover-color};
--table-hover-bg: #{$table-hover-bg};
--bs-table-bg: #{$table-bg};
--bs-table-accent-bg: transparent;
--bs-table-striped-color: #{$table-striped-color};
--bs-table-striped-bg: #{$table-striped-bg};
--bs-table-active-color: #{$table-active-color};
--bs-table-active-bg: #{$table-active-bg};
--bs-table-hover-color: #{$table-hover-color};
--bs-table-hover-bg: #{$table-hover-bg};
width: 100%;
margin-bottom: $spacer;
@ -25,8 +25,8 @@
// stylelint-disable-next-line selector-max-universal
> :not(caption) > * > * {
padding: $table-cell-padding;
background-color: var(--table-bg);
background-image: linear-gradient(var(--table-accent-bg), var(--table-accent-bg));
background-color: var(--bs-table-bg);
background-image: linear-gradient(var(--bs-table-accent-bg), var(--bs-table-accent-bg));
border-bottom-width: $table-border-width;
}
@ -101,8 +101,8 @@
.table-striped {
> tbody > tr:nth-of-type(#{$table-striped-order}) {
--table-accent-bg: var(--table-striped-bg);
color: var(--table-striped-color);
--bs-table-accent-bg: var(--bs-table-striped-bg);
color: var(--bs-table-striped-color);
}
}
@ -111,8 +111,8 @@
// The `.table-active` class can be added to highlight rows or cells
.table-active {
--table-accent-bg: var(--table-active-bg);
color: var(--table-active-color);
--bs-table-accent-bg: var(--bs-table-active-bg);
color: var(--bs-table-active-color);
}
// Hover effect
@ -121,8 +121,8 @@
.table-hover {
> tbody > tr:hover {
--table-accent-bg: var(--table-hover-bg);
color: var(--table-hover-color);
--bs-table-accent-bg: var(--bs-table-hover-bg);
color: var(--bs-table-hover-color);
}
}

View File

@ -6,13 +6,13 @@
$striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
$active-bg: mix($color, $background, percentage($table-active-bg-factor));
--table-bg: #{$background};
--table-striped-bg: #{$striped-bg};
--table-striped-color: #{color-contrast($striped-bg)};
--table-active-bg: #{$active-bg};
--table-active-color: #{color-contrast($active-bg)};
--table-hover-bg: #{$hover-bg};
--table-hover-color: #{color-contrast($hover-bg)};
--bs-table-bg: #{$background};
--bs-table-striped-bg: #{$striped-bg};
--bs-table-striped-color: #{color-contrast($striped-bg)};
--bs-table-active-bg: #{$active-bg};
--bs-table-active-color: #{color-contrast($active-bg)};
--bs-table-hover-bg: #{$hover-bg};
--bs-table-hover-color: #{color-contrast($hover-bg)};
color: $color;
border-color: mix($color, $background, percentage($table-border-factor));

View File

@ -212,10 +212,10 @@ Highlight a table row or cell by adding a `.table-active` class.
For the accented tables ([striped rows](#striped-rows), [hoverable rows](#hoverable-rows) and [active tables](#active-tables)), we used some techniques to make these effects work for all our [table variants](#variants):
- First of all we set the background of a table cell with the `--table-bg` custom property. All table variants then set that custom property to colorize the table cells. This way, we don't get into trouble if semi-transparent colors are used as table backgrounds.
- Then we add a linear background to the table cells with `background-image: linear-gradient(var(--table-accent-bg), var(--table-accent-bg));`. Since `--table-accent-bg` is transparent by default, we have an invisible transparent linear gradient by default.
- When either `.table-striped`, `.table-hover` or `.table-active` classes are added, the `--table-accent-bg` is set to a semitransparent color to colorize the background.
- For each table variant the `--table-accent-bg` color with the most contrast is generated, therefor `.table-primary` has a darkened accent color and `.table-dark` has a lightened accent color.
- First of all we set the background of a table cell with the `--bs-table-bg` custom property. All table variants then set that custom property to colorize the table cells. This way, we don't get into trouble if semi-transparent colors are used as table backgrounds.
- Then we add a linear background to the table cells with `background-image: linear-gradient(var(--bs-table-accent-bg), var(--bs-table-accent-bg));`. Since `--bs-table-accent-bg` is transparent by default, we have an invisible transparent linear gradient by default.
- When either `.table-striped`, `.table-hover` or `.table-active` classes are added, the `--bs-table-accent-bg` is set to a semitransparent color to colorize the background.
- For each table variant the `--bs-table-accent-bg` color with the most contrast is generated, therefor `.table-primary` has a darkened accent color and `.table-dark` has a lightened accent color.
- The text color and border color are also generated the same way. The colors and border colors are inherited by default.
Behind the scenes it looks like this: