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

can't change $component-active-bg to my theme color #27712

Closed
blackinitial opened this issue Nov 23, 2018 · 7 comments
Closed

can't change $component-active-bg to my theme color #27712

blackinitial opened this issue Nov 23, 2018 · 7 comments
Assignees

Comments

@blackinitial
Copy link

i was created custom style bootstrap,
i want to change active bg on nav-pill from blue to green on my theme color.
i try to change var $component-active-bg to theme-color("primary") $component-active-bg: theme-color("primary"); , but the color not change to green.

so i was changed with var $nav-pills-link-active-bg: theme-color("primary"); and success.

is it a bug ??

@blackinitial blackinitial changed the title can't change $component-active-bg can't change $component-active-bg to my theme color Nov 23, 2018
@ysds
Copy link
Member

ysds commented Dec 4, 2018

It seems to be related with #27378.

demo1: https://codepen.io/fellows3/pen/WYBbEM

$theme-colors: (
  "primary": green
);

demo2: https://codepen.io/fellows3/pen/ZmNYNd

$primary: green;

@MartijnCuppens Any thoughts?

@blackinitial
Copy link
Author

still not change, if i use $component-active-bg, i was try :

$primary: #20bf6b;
$component-active-bg: $primary;

but if use $nav-pills-link-active-bg active bg changed:

$primary: #20bf6b;
$nav-pills-link-active-bg: $primary;

its look same with my question above, only different theme-color("primary") to $primary.

@ysds
Copy link
Member

ysds commented Dec 5, 2018

I'm not sure how you would overwrite SCSS, but you need to include your custom variables before including bootstrap's SCSS.
https://getbootstrap.com/docs/4.1/getting-started/theming/#variable-defaults

@MartijnCuppens MartijnCuppens self-assigned this Dec 5, 2018
@blackinitial
Copy link
Author

@ysds

this is how i create my custom theme default.scss

// 1. core variables and mixins
@import "../bootstrap/functions";
@import "../bootstrap/variables";
@import "../bootstrap/mixins";

// 2. custom core variables

// colors
@import "_partials/colors";

and this is _partials/colors.scss

/ colors from http://flatuicolors.com/ german pallette
$theme-colors : (
  "primary":    #20bf6b,
  "secondary":  #778ca3,
  "success":    #26de81,
  "info":       #4b7bec,
  "warning":    #fed330,
  "danger":     #fc5c65,
  "light":      #ffffff,
  "dark":       #343a40
);

// color body
$body-bg:                 $white;
$body-color:              #423f54;
// $yiq-text-dark:         #423f54;

// link colors
$link-color:            theme-color("primary");
$link-hover-color:      darken($link-color, 15%);
$link-hover-decoration: none;

// component
$component-active-color:      $white;
// $component-active-bg:         theme-color("primary"); // can't use
$nav-pills-link-active-bg:    theme-color("primary");

// dropdown
$dropdown-link-active-bg:     theme-color("primary");

is this right??

@MartijnCuppens
Copy link
Member

@blackinitial, you'll need to define your variables before including bootstrap. You can read about that here: http://getbootstrap.com/docs/4.1/getting-started/theming/#variable-defaults

However, when overriding across Sass files, your overrides must come before you import Bootstrap’s Sass files.

@MartijnCuppens
Copy link
Member

MartijnCuppens commented Dec 6, 2018

Ow, and it is also better to change the theme colors here, because these variables are also used later in the variables file:

$primary: $blue !default;
$secondary: $gray-600 !default;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
$danger: $red !default;
$light: $gray-100 !default;
$dark: $gray-800 !default;

@blackinitial
Copy link
Author

oh ok, i delete $theme-color and use variable $primary etc..

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

No branches or pull requests

3 participants