Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dark mode for Bootstrap 5 #4548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DastardlySky
Copy link

This issue has been raised before on here and on SO:
#4380

https://stackoverflow.com/questions/77524543/tabulator-js-5-apply-bootstrap-js-5-dark-theme

However, the issue still seems to persist when applying table-dark to bootstrap tables.

Currently, this is what a table looks like with the "table-dark" class:
https://jsfiddle.net/Lz8eacs7/

image

With the changes to the .scss files, when the compiled .css file is used it looks like this:
https://jsfiddle.net/tyvawr40

image

updated bootstrap scss files to support the use of table-dark.
@DastardlySky DastardlySky changed the title Fixed dark mode for Bootstrap 5 fix dark mode for Bootstrap 5 Jul 30, 2024
@liepumartins
Copy link

liepumartins commented Jan 7, 2025

Initially I happily though this will solve my problem and I urged to merge this.

However this does not switch between dark/light modes data-bs-theme="light" and data-bs-theme="dark". Rather it provides a fixed class .table-dark that stays dark even on light page.

EDIT:
what I meant is something along the lines

Add to scss file overrides for dark mode, referenced variables come from bootstrap _variables_dark.scss file:

[data-bs-theme="dark"] {
    .tabulator {
        background-color: $body-bg-dark;
        color: $body-color-dark;
        border-color: $border-color-dark;

        .tabulator-row {
            background-color: $body-bg-dark;
            color: $body-color-dark;
            border-color: $border-color-dark;

            &:hover {
                background-color: $body-tertiary-bg-dark;
                color: $body-color-dark;
                border-color: $border-color-dark;
            }
        }



        &:not(.thead-light) .tabulator-header {
            background-color: $body-bg-dark;
            color: $body-color-dark;
            border-color: $border-color-dark;

            .tabulator-col {
                background-color: $body-bg-dark;
                &:hover {
                    background-color: $body-tertiary-bg-dark;
                    color: $body-color-dark;
                    border-color: $border-color-dark;
                }

                .tabulator-header-filter {
                    input {
                        background-color: $body-bg-dark;
                        border: 1px solid $border-color-dark;
                        color: $body-color-dark;
                        &:focus {
                            color: $body-color-dark;
                            background-color: $body-bg-dark;
                            border: 1px solid $primary;
                        }
                    }
                }
            }
        }

        .tabulator-footer {
            background-color: $body-tertiary-bg-dark;
            color: $body-color-dark;
            border-color: $border-color-dark;
        }

        .tabulator-cell {
            background-color: $body-bg-dark;
            color: $body-color-dark;
            border-color: $border-color-dark;

            &:hover {
                background-color: $body-tertiary-bg-dark;
                color: $body-color-dark;
                border-color: $border-color-dark;
            }
        }
    }
}

This is a crude example and something might still be light, but the idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants