Skip to content

jprivet-dev/bootstrap-dark-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootstrap 4.6 - Dark Mode

1. Presentation

Create your own Bootstrap dark mode by changing only variables.

bootstrap dark mode preview

2. Quick start

3. Create your own theme

3.1. The default variables of Bootstrap

Every Sass variable in Bootstrap includes the !default flag allowing you to override the variable’s default value in your own Sass without modifying Bootstrap’s source code (https://getbootstrap.com/docs/4.6/getting-started/theming/#variable-defaults).

💡

Sass provides the !default flag. This assigns a value to a variable only if that variable isn’t defined or its value is null. Otherwise, the existing value will be used.

3.2. Import your own variables

This project imports the precompiled Sass with Webpack Encore:

Create your own _variables.scss and use it to override the built-in custom variables. Then, use your main Sass file to import your custom variables, followed by Bootstrap:

@import "variables";
@import "~bootstrap/scss/bootstrap";

3.3. Can I use the variables of this repo directly in my existing project?

Yeees 🎉

If your own project is able to compile SCSS files, you can copy/past in your project all variables from the file assets/styles/_variables.scss.

3.4. The colors of this dark mode version

Find all the colors used in assets/styles/_variables.scss.

💡
The colors were inspired by the different interfaces I could find on Pinterest: https://www.pinterest.fr/jeanphilipperivet/ui-dark-mode/

Main colors (see on coolors.co):

main colors

Shades of grey 1 (see on coolors.co):

shades of grey 1

Shades of grey 2 (see on coolors.co):

shades of grey 2

Voilà ! All you have to do is vary the colors 😃