1

I am using bootstrap 4 alpha-6,I want to modify bootstrap 4's primary color(#0275d8),is there a variable that can set the value?

creimers
  • 4,975
  • 4
  • 33
  • 55
zwl1619
  • 4,002
  • 14
  • 54
  • 110

2 Answers2

0

You could overwrite the relevant css styles with your own custom styles, otherwise it might be worth it to look into using Less. Less is a CSS Preprocessor that allows you to store variables used in your css such as color values. You can see an example of this below:

@brand-primary: darken(#428bca, 6.5%); // #337ab7
@brand-success: #5cb85c;
@brand-info:    #5bc0de;
@brand-warning: #f0ad4e;
@brand-danger:  #d9534f;

.masthead {
  background-color: @brand-primary;
}

You can read more on bootstraps use of Less here

Tony
  • 2,890
  • 1
  • 24
  • 35
-1

Update 2019 Bootstrap 4

It's easily done with SASS. Just set the $brand-primary $primary variable.

$primary: hotpink;

Demo on Codeply


See: How to change the bootstrap primary color?

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
  • In Bootstrap v4. It's been changed to the `$primary` variable. https://github.com/twbs/bootstrap/blob/v4.0.0/scss/_variables.scss – kartikluke Jan 22 '18 at 08:35