ttskch / select2-bootstrap4-theme

Select2 v4 theme for Bootstrap4
MIT License
435 stars 206 forks source link

Unable to use modified bootstrap $primary variable #46

Closed imtiazShakil closed 1 month ago

imtiazShakil commented 4 years ago

In my styles.scss, I import _variables.scss to modify boostrap default $blue variable which changes bootstrap's $primary colour.

but this change is not picked up by your layout.scss because you are importing bootstrap variables again.

// layout.scss
@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/mixins";

Because of this mouse hovered item doesn't display the right colour:

    // mouse hovered item
    .select2-results__option--highlighted,
    .select2-results__option--highlighted.select2-results__option[aria-selected=true] {
        background-color: $primary;
        color: $light;
    }
ttskch commented 4 years ago

@imtiazShakil Sorry for my late response. Why don't you just add $primary: $blue; in your styles.scss ?

imtiazShakil commented 4 years ago

for my project, I required to change the bootstrap default $blue variable which automatically updates $primary variable and all others which depend on $blue variable.

but the issue is, my modification doesn't work when I import your scss.

fabiocaccamo commented 4 years ago

Thank you for this theme.

I have exactly the same problem, I think that you should use colors from bootstrap variables, otherwise when using sass this select ignores theme colors customizations.

rodrigo-arias commented 3 years ago

Probably related to #51

bbugh commented 3 years ago

We have a number of variables (input padding for example) that the layout import of re-importing bootstrap is clobbering. I don't think there's a way that you can re-import the variables without breaking a lot of stuff. I think the installation instructions will require that bootstrap already be imported before importing the library, which I think is a reasonable ask.

For now, we've just copied the scss into our own source, but that's not ideal.

fabiocaccamo commented 3 years ago

I attach you here my solution, hope it will help to solve this. _select2-bootstrap4-fix.scss.zip

tagliala commented 3 years ago

I think that this issue has been fixed via e946eeda681c5c116bf6f21a7caf4dcee8d18721, because _*.scss files don't import from bootstrap anymore.

Bootstrap variables are only used to build the default distributable .css files

imtiazShakil commented 1 month ago

thanks. I'm closing the issue