Skip to content

Commit 952a19e

Browse files
authored
Merge pull request #4548 from DastardlySky/fix-bootstrap-5-dark-mode
fix dark mode for Bootstrap 5
2 parents 03a7b07 + df587c0 commit 952a19e

File tree

2 files changed

+136
-15
lines changed

2 files changed

+136
-15
lines changed

src/scss/themes/bootstrap/tabulator_bootstrap5.scss

Lines changed: 123 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,20 +178,6 @@ $table-cell-padding-sm: 5px;
178178

179179
//Bootstrap theming classes
180180

181-
&.thead-dark{
182-
.tabulator-header{
183-
border-color: $borderColor;
184-
background-color: $backgroundColor;
185-
color: $table-color;
186-
187-
.tabulator-col{
188-
border-color: $borderColor;
189-
background-color: $backgroundColor;
190-
color: $table-color;
191-
}
192-
}
193-
}
194-
195181
&.table{
196182
background-color: $backgroundColor;
197183

@@ -347,6 +333,129 @@ $table-cell-padding-sm: 5px;
347333
}
348334

349335

336+
337+
&.thead-dark{
338+
.tabulator-header{
339+
border-color: $table-dark-border-color;
340+
background-color: $table-dark-bg;
341+
color: $table-dark-color;
342+
343+
.tabulator-col{
344+
border-color: $table-dark-border-color;
345+
background-color: $table-dark-bg;
346+
color: $table-dark-color;
347+
}
348+
}
349+
}
350+
351+
&.table-striped{
352+
&:not(.table-dark),
353+
html:not([data-bs-theme="dark"]) &{
354+
.tabulator-row{
355+
&.tabulator-row-even{
356+
background-color: $rowAltBackgroundColor;
357+
358+
&.tabulator-selected{
359+
background-color:$rowSelectedBackground;
360+
}
361+
362+
@media (hover:hover) and (pointer:fine){
363+
&.tabulator-selectable:hover{
364+
background-color:$rowHoverBackground;
365+
cursor: pointer;
366+
}
367+
368+
&.tabulator-selected:hover{
369+
background-color:$rowSelectedBackgroundHover;
370+
cursor: pointer;
371+
}
372+
}
373+
}
374+
}
375+
}
376+
377+
&.table-dark,
378+
html[data-bs-theme="dark"] & {
379+
.tabulator-row{
380+
&:nth-child(even){
381+
background-color: $table-dark-striped-bg !important;
382+
.tabulator-cell{
383+
background-color: inherit;
384+
}
385+
}
386+
}
387+
}
388+
}
389+
390+
&.table-dark,
391+
html[data-bs-theme="dark"] &{
392+
background-color: $table-dark-bg;
393+
394+
&:not(.thead-light) .tabulator-header{
395+
border-color: $table-dark-border-color;
396+
background-color: $table-dark-bg;
397+
color: $table-dark-color;
398+
399+
.tabulator-col{
400+
border-color: $table-dark-border-color;
401+
background-color: $table-dark-bg;
402+
color: $table-dark-color;
403+
}
404+
}
405+
406+
.tabulator-tableholder{
407+
color: $table-dark-color;
408+
}
409+
410+
.tabulator-cell {
411+
color: $table-dark-color;
412+
background-color: $table-dark-bg;
413+
border-color: $table-dark-border-color;
414+
}
415+
416+
.tabulator-row{
417+
border-color: $table-dark-border-color;
418+
background-color: $table-dark-bg;
419+
color: $table-dark-color;
420+
421+
@media (hover:hover) and (pointer:fine){
422+
&:hover{
423+
background-color: $table-dark-border-color;
424+
425+
.tabulator-cell{
426+
background-color: $table-dark-hover-bg;
427+
}
428+
}
429+
}
430+
431+
&.tabulator-selected{
432+
background-color:$table-dark-active-bg;
433+
}
434+
}
435+
436+
.tabulator-footer{
437+
border-color: $table-dark-border-color !important;
438+
color: $table-dark-bg !important;
439+
440+
.tabulator-calcs-holder{
441+
border-color: $table-dark-border-color !important;
442+
background:$table-dark-bg !important;
443+
444+
.tabulator-row{
445+
border-color: $table-dark-border-color !important;
446+
background-color: $table-dark-bg !important;
447+
color: $table-dark-color !important;
448+
}
449+
}
450+
}
451+
452+
input {
453+
color: $table-dark-color !important;
454+
background-color: $table-active-bg !important;
455+
}
456+
457+
}
458+
350459
//row colors
351460
.tabulator-tableholder{
352461
.tabulator-table{

src/scss/themes/bootstrap/variables5.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,17 @@ $table-color: $body-color !default;
695695
$table-bg: #fff !default;
696696
$table-accent-bg: transparent !default;
697697

698+
$table-dark-color: #fff;
699+
$table-dark-bg: #212529;
700+
$table-dark-border-color: #4d5154;
701+
$table-dark-striped-bg: #2c3034;
702+
$table-dark-striped-color: #fff;
703+
$table-dark-active-bg: #373b3e;
704+
$table-dark-active-color: #fff;
705+
$table-dark-hover-bg: #323539;
706+
$table-dark-hover-color: #fff;
707+
708+
698709
$table-th-font-weight: null !default;
699710

700711
$table-striped-color: $table-color !default;
@@ -720,6 +731,7 @@ $table-group-separator-color: currentColor !default;
720731
$table-caption-color: $text-muted !default;
721732

722733
$table-bg-scale: -80% !default;
734+
723735
// scss-docs-end table-variables
724736

725737
// scss-docs-start table-loop
@@ -1638,4 +1650,4 @@ $kbd-font-size: $code-font-size !default;
16381650
$kbd-color: $white !default;
16391651
$kbd-bg: $gray-900 !default;
16401652

1641-
$pre-color: null !default;
1653+
$pre-color: null !default;

0 commit comments

Comments
 (0)