bootswatch README

The project's README from github.com/thomaspark/bootswatch. As one markdown file: README.md.

Bootswatch

A collection of open source themes for Bootstrap
View Bootswatch themes »

Report bug · Request feature · Blog

Usage

There are a few different ways you can integrate Bootswatch into your project.

Via Pre-compiled Asset

Download the bootstrap.min.css file associated with a theme and replace Bootstrap's default stylesheet. You must still include Bootstrap's JavaScript file to have functional dropdowns, modals, etc.

Via CDN

You can use the themes via CDN at jsDelivr.

Via Sass Imports

If you're using Sass (SCSS) in your project, you can import the _variables.scss and _bootswatch.scss files for a given theme. This method allows you to override theme variables.

// Your variable overrides go here, e.g.:
// $h1-font-size: 3rem;

@import "~bootswatch/dist/[theme]/variables";
@import "~bootstrap/scss/bootstrap";
@import "~bootswatch/dist/[theme]/bootswatch";

Make sure to import Bootstrap's bootstrap.scss in between _variables.scss and _bootswatch.scss!

Via npm

You can install as a package with the command npm install bootswatch.

React Users (create-react-app, or similar bundler)

Modern JavaScript bundlers (webpack, parcel, rollup) support importing CSS from JS files. This can make it easier to deploy various 1st and 3rd party assets predictably. Note: There are tradeoffs to the following method, research your tooling before deploying to production.

Before continuing, ensure you've run npm install bootswatch in your local project folder. (Use either npm or yarn.)

Add the following import to your top-level index.js (or App.js) file. Add it before any other .css imports.

import "bootswatch/dist/[theme]/bootstrap.min.css";
// TODO: Note: Replace ^[theme]^ (examples: darkly, slate, cosmo, spacelab, and superhero. See https://bootswatch.com for current theme names.)

Here's an example of updated imports in App.js to use "slate" theme (using a create-react-app fresh project.)

import React from 'react';
import logo from './logo.svg';
import 'bootswatch/dist/slate/bootstrap.min.css'; // Added this :boom:
import './App.css';

function App() {
...

Via Ruby Gem

In your Ruby project, you can access the latest version of each theme by adding the following to your Gemfile and running bundle install:

gem "bootswatch", github: "thomaspark/bootswatch"

Each theme directory is then accessible via the path "#{Gem.loaded_specs["bootswatch"].load_paths.first}/[theme]".

Ruby on Rails users can add the following to an initializer (e.g. config/initializers/bootswatch.rb):

Rails.application.config.assets.paths += Gem.loaded_specs["bootswatch"].load_paths

And thus be able to import themes via Sass like so:

@import "[theme]/variables";
@import "~bootstrap/scss/bootstrap";
@import "[theme]/bootswatch";

Via API

A simple JSON API is available for integrating your platform with Bootswatch. More info can be found on the Help page.

Customization

Bootswatch is open source and you’re welcome to modify the themes.

Each theme consists of two SASS files. _variables.scss, which is included by default in Bootstrap, allows you to customize the settings. _bootswatch.scss introduces more extensive structural changes.

Check out the Help page for more details on building your own theme.

Contributing

It's through your contributions that Bootswatch will continue to improve. You can contribute in several ways:

Author

Thomas Park

Thanks

Copyright 2014-2023 Thomas Park

Code released under the MIT License.

bootswatch (thomaspark/bootswatch)

scss
Searching Database…

What is this?Bootswatch is a collection of free, open-source themes for Bootstrap, letting you swap Bootstrap's default look for pre-built styles like Slate, Flatly, or Cyborg.
Is this a library or just a set of stylesheets?It's a set of pre-built CSS/Sass theme files you drop into a Bootstrap project, not a JavaScript library or framework with its own API.
How do I add a theme to my project?Download the compiled bootstrap.min.css for a theme and swap it in, link it via the jsDelivr CDN, import variables.scss and bootswatch.scss in your Sass build, or install the npm package with 'npm install bootswatch'.
Do I need Bootstrap itself installed for these themes to work?Yes, Bootswatch themes only provide the styling; you still need Bootstrap's own JavaScript (and CSS structure) for things like dropdowns and modals to function.
Does it work with Ruby on Rails too?Yes, there's a Ruby gem you add to your Gemfile, and Rails users can wire it up via an initializer to import themes through Sass.
Can I build my own custom theme instead of using the included ones?Yes, Bootswatch is open source and you can modify or build your own theme by editing variables.scss for basic settings and bootswatch.scss for deeper structural changes, as detailed on the Help page.
Is there an API to integrate Bootswatch into another platform?Yes, a simple JSON API is available for integrating your platform with Bootswatch's theme data, with more details on the Help page.
How do I use it in a React app built with create-react-app?After running 'npm install bootswatch', import the desired theme's CSS at the top of your index.js or App.js, before any other CSS imports.
Creator
thomaspark
Size
91.6 MB
Stars
14.7K
Updated
CommitApr 16
Age
14y
Commits · 90 Days