I am hoping this isnāt too massive a post in terms of text volumeā¦
I have spend a good few hours cleaning up the _variables.scss file in the Bootstrap 3 (v3.3.6 to be more precise) SASS library. The reason for this was that for me I really wanted
-
A table of contents
-
Less fluff in terms of comments and the positioning of the comments on separate lines, bloating the file line count
-
The use of tabs to have all the variable values in neat order
Additionally (and the actual reason I started cleaning it up) is that I wanted all the color css variables in a single file as I much prefer being able to get to the colours quickly and easily when styling the frontend. Every coder has their own mannerisms when working and when working on frontend stuff I want to be able to see the colour scheme clearly in 1 place, especially when using the likes of SASS which passes previous variables as arguments for computing other variables.
So below there will be 2 code dumps:-
The first is the contents of my _colours.scss file which contains only the colour variables from the v3.3.36 library, in a single file, with a table on contents.
The second is the remaining contents of my _variables.scss file, cleaned up to take out comment fluff etc, with a table on contents.
Please note that: -
-
All references to Glyphicons have been removed from the files as I donāt use them, they are deprecated in Bootstrap, having been removed entirely in the upcoming B4.
-
When running your compiler, include _colours.scss first so you donāt get a load of variable-not-found errors.
-
References to shadows remaining in the _variables.scss file, and this should be the only time colour references remain. Example: -
// CAROUSEL
$carousel-text-shadow: 0 1px 2px rgba(0,0,0,.6) !default;
- Compilation using these files has been run and it is compiling without error (again, make sure you are not including Glyphicons or you will get errors).
I am not sure if this will be of much use to anyone, but considering the time I put into it, I thought I would put it out there in the off-chance it might help other developers.
_colours.scssā¦
// Table of Contents
// BASE
// SCAFFOLDING
// COMPONENTS
// TABLES
// BUTTONS
// FORMS
// DROPDOWNS
// NAVBAR
// NAV
// TABS
// PILLS
// PAGINATION
// PAGER
// JUMBOTRON
// FORM STATES AND ALERTS
// TOOLTIP
// POPOVERS
// LABELS
// MODALS
// ALERTS
// PROGRESS BARS
// LIST GROUP
// PANELS
// THUMBNAILS
// WELLS
// BADGES
// BREADCRUMBS
// CAROUSEL
// CLOSE
// CODE
// TYPE
// BASE
$gray-base: #000 !default;
$gray-darker: lighten($gray-base, 13.5%) !default; // #222
$gray-dark: lighten($gray-base, 20%) !default; // #333
$gray: lighten($gray-base, 33.5%) !default; // #555
$gray-light: lighten($gray-base, 46.7%) !default; // #777
$gray-lighter: lighten($gray-base, 93.5%) !default; // #eee
$brand-primary: darken(#428bca, 6.5%) !default; // #337ab7
$brand-success: #5cb85c !default;
$brand-info: #5bc0de !default;
$brand-warning: #f0ad4e !default;
$brand-danger: #d9534f !default;
// SCAFFOLDING
// `<body>`.
$body-bg: #fff !default;
$text-color: $gray-dark !default;
// link global
$link-color: $brand-primary !default;
$link-hover-color: darken($link-color, 15%) !default;
// COMPONENTS
//** Global color for active items (e.g., navs or dropdowns).
$component-active-color: #fff !default;
$component-active-bg: $brand-primary !default;
// TABLES
// Default for all tables.
$table-bg: transparent !default;
$table-border-color: #ddd !default;
$table-bg-accent: #f9f9f9 !default; //** Background color used for `.table-striped`.
$table-bg-hover: #f5f5f5 !default; //** Background color used for `.table-hover`.
$table-bg-active: $table-bg-hover !default;
// BUTTONS
$btn-default-color: #333 !default;
$btn-default-bg: #fff !default;
$btn-default-border: #ccc !default;
$btn-primary-color: #fff !default;
$btn-primary-bg: $brand-primary !default;
$btn-primary-border: darken($btn-primary-bg, 5%) !default;
$btn-success-color: #fff !default;
$btn-success-bg: $brand-success !default;
$btn-success-border: darken($btn-success-bg, 5%) !default;
$btn-info-color: #fff !default;
$btn-info-bg: $brand-info !default;
$btn-info-border: darken($btn-info-bg, 5%) !default;
$btn-warning-color: #fff !default;
$btn-warning-bg: $brand-warning !default;
$btn-warning-border: darken($btn-warning-bg, 5%) !default;
$btn-danger-color: #fff !default;
$btn-danger-bg: $brand-danger !default;
$btn-danger-border: darken($btn-danger-bg, 5%) !default;
$btn-link-disabled-color: $gray-light !default;
// FORMS
$input-bg: #fff !default;
$input-bg-disabled: $gray-lighter !default;
$input-color: $gray !default;
$input-border: #ccc !default;
$input-border-focus: #66afe9 !default;
$input-color-placeholder: #999 !default;
$legend-color: $gray-dark !default;
$legend-border-color: #e5e5e5 !default;
// textual input addons
$input-group-addon-bg: $gray-lighter !default;
$input-group-addon-border-color: $input-border !default;
// DROPDOWNS
$dropdown-bg: #fff !default;
$dropdown-border: rgba(0,0,0,.15) !default;
$dropdown-fallback-border: #ccc !default; //** Dropdown menu `border-color` **for IE8**
$dropdown-divider-bg: #e5e5e5 !default;
$dropdown-link-color: $gray-dark !default;
$dropdown-link-hover-color: darken($gray-dark, 5%) !default;
$dropdown-link-hover-bg: #f5f5f5 !default;
$dropdown-link-active-color: $component-active-color !default;
$dropdown-link-active-bg: $component-active-bg !default;
$dropdown-link-disabled-color: $gray-light !default;
$dropdown-header-color: $gray-light !default;
$dropdown-caret-color: #000 !default; //** Deprecated `$dropdown-caret-color` as of v3.1.0
// NAVBAR
$navbar-default-color: #777 !default;
$navbar-default-bg: #f8f8f8 !default;
$navbar-default-border: darken($navbar-default-bg, 6.5%) !default;
$navbar-default-link-color: #777 !default;
$navbar-default-link-hover-color: #333 !default;
$navbar-default-link-hover-bg: transparent !default;
$navbar-default-link-active-color: #555 !default;
$navbar-default-link-active-bg: darken($navbar-default-bg, 6.5%) !default;
$navbar-default-link-disabled-color: #ccc !default;
$navbar-default-link-disabled-bg: transparent !default;
$navbar-default-brand-color: $navbar-default-link-color !default;
$navbar-default-brand-hover-color: darken($navbar-default-brand-color, 10%) !default;
$navbar-default-brand-hover-bg: transparent !default;
$navbar-default-toggle-hover-bg: #ddd !default;
$navbar-default-toggle-icon-bar-bg: #888 !default;
$navbar-default-toggle-border-color: #ddd !default;
$navbar-inverse-color: lighten($gray-light, 15%) !default;
$navbar-inverse-bg: #222 !default;
$navbar-inverse-border: darken($navbar-inverse-bg, 10%) !default;
$navbar-inverse-link-color: lighten($gray-light, 15%) !default;
$navbar-inverse-link-hover-color: #fff !default;
$navbar-inverse-link-hover-bg: transparent !default;
$navbar-inverse-link-active-color: $navbar-inverse-link-hover-color !default;
$navbar-inverse-link-active-bg: darken($navbar-inverse-bg, 10%) !default;
$navbar-inverse-link-disabled-color: #444 !default;
$navbar-inverse-link-disabled-bg: transparent !default;
$navbar-inverse-brand-color: $navbar-inverse-link-color !default;
$navbar-inverse-brand-hover-color: #fff !default;
$navbar-inverse-brand-hover-bg: transparent !default;
$navbar-inverse-toggle-hover-bg: #333 !default;
$navbar-inverse-toggle-icon-bar-bg: #fff !default;
$navbar-inverse-toggle-border-color: #333 !default;
// NAV
$nav-link-hover-bg: $gray-lighter !default;
$nav-disabled-link-color: $gray-light !default;
$nav-disabled-link-hover-color: $gray-light !default;
// TABS
$nav-tabs-border-color: #ddd !default;
$nav-tabs-link-hover-border-color: $gray-lighter !default;
$nav-tabs-active-link-hover-bg: $body-bg !default;
$nav-tabs-active-link-hover-color: $gray !default;
$nav-tabs-active-link-hover-border-color: #ddd !default;
$nav-tabs-justified-link-border-color: #ddd !default;
$nav-tabs-justified-active-link-border-color: $body-bg !default;
// PILLS
$nav-pills-active-link-hover-bg: $component-active-bg !default;
$nav-pills-active-link-hover-color: $component-active-color !default;
// PAGINATION
$pagination-color: $link-color !default;
$pagination-bg: #fff !default;
$pagination-border: #ddd !default;
$pagination-hover-color: $link-hover-color !default;
$pagination-hover-bg: $gray-lighter !default;
$pagination-hover-border: #ddd !default;
$pagination-active-color: #fff !default;
$pagination-active-bg: $brand-primary !default;
$pagination-active-border: $brand-primary !default;
$pagination-disabled-color: $gray-light !default;
$pagination-disabled-bg: #fff !default;
$pagination-disabled-border: #ddd !default;
// PAGER
$pager-bg: $pagination-bg !default;
$pager-border: $pagination-border !default;
$pager-hover-bg: $pagination-hover-bg !default;
$pager-active-bg: $pagination-active-bg !default;
$pager-active-color: $pagination-active-color !default;
$pager-disabled-color: $pagination-disabled-color !default;
// JUMBOTRON
$jumbotron-color: inherit !default;
$jumbotron-bg: $gray-lighter !default;
$jumbotron-heading-color: inherit !default;
// FORM STATES AND ALERTS (Define colors for form feedback states and, by default, alerts)
$state-success-text: #3c763d !default;
$state-success-bg: #dff0d8 !default;
$state-success-border: darken(adjust-hue($state-success-bg, -10), 5%) !default;
$state-info-text: #31708f !default;
$state-info-bg: #d9edf7 !default;
$state-info-border: darken(adjust-hue($state-info-bg, -10), 7%) !default;
$state-warning-text: #8a6d3b !default;
$state-warning-bg: #fcf8e3 !default;
$state-warning-border: darken(adjust-hue($state-warning-bg, -10), 5%) !default;
$state-danger-text: #a94442 !default;
$state-danger-bg: #f2dede !default;
$state-danger-border: darken(adjust-hue($state-danger-bg, -10), 5%) !default;
// TOOLTIP
$tooltip-color: #fff !default;
$tooltip-bg: #000 !default;
$tooltip-opacity: .9 !default;
$tooltip-arrow-color: $tooltip-bg !default;
// POPOVERS
$popover-bg: #fff !default;
$popover-border-color: rgba(0,0,0,.2) !default;
$popover-fallback-border-color: #ccc !default;
$popover-title-bg: darken($popover-bg, 3%) !default;
$popover-arrow-color: $popover-bg !default;
$popover-arrow-outer-color: fade_in($popover-border-color, 0.05) !default;
$popover-arrow-outer-fallback-color: darken($popover-fallback-border-color, 20%) !default;
// LABELS
$label-default-bg: $gray-light !default;
$label-primary-bg: $brand-primary !default;
$label-success-bg: $brand-success !default;
$label-info-bg: $brand-info !default;
$label-warning-bg: $brand-warning !default;
$label-danger-bg: $brand-danger !default;
$label-color: #fff !default;
$label-link-hover-color: #fff !default;
// MODALS
$modal-content-bg: #fff !default;
$modal-content-border-color: rgba(0,0,0,.2) !default;
$modal-content-fallback-border-color: #999 !default;
$modal-backdrop-bg: #000 !default;
$modal-backdrop-opacity: .5 !default;
$modal-header-border-color: #e5e5e5 !default;
$modal-footer-border-color: $modal-header-border-color !default;
// ALERTS
$alert-success-bg: $state-success-bg !default;
$alert-success-text: $state-success-text !default;
$alert-success-border: $state-success-border !default;
$alert-info-bg: $state-info-bg !default;
$alert-info-text: $state-info-text !default;
$alert-info-border: $state-info-border !default;
$alert-warning-bg: $state-warning-bg !default;
$alert-warning-text: $state-warning-text !default;
$alert-warning-border: $state-warning-border !default;
$alert-danger-bg: $state-danger-bg !default;
$alert-danger-text: $state-danger-text !default;
$alert-danger-border: $state-danger-border !default;
// PROGRESS BARS
$progress-bg: #f5f5f5 !default;
$progress-bar-color: #fff !default;
$progress-bar-bg: $brand-primary !default;
$progress-bar-success-bg: $brand-success !default;
$progress-bar-warning-bg: $brand-warning !default;
$progress-bar-danger-bg: $brand-danger !default;
$progress-bar-info-bg: $brand-info !default;
// LIST GROUP
$list-group-bg: #fff !default;
$list-group-border: #ddd !default;
$list-group-hover-bg: #f5f5f5 !default;
$list-group-active-color: $component-active-color !default;
$list-group-active-bg: $component-active-bg !default;
$list-group-active-border: $list-group-active-bg !default;
$list-group-active-text-color: lighten($list-group-active-bg, 40%) !default;
$list-group-disabled-color: $gray-light !default;
$list-group-disabled-bg: $gray-lighter !default;
$list-group-disabled-text-color: $list-group-disabled-color !default;
$list-group-link-color: #555 !default;
$list-group-link-hover-color: $list-group-link-color !default;
$list-group-link-heading-color: #333 !default;
// PANELS
$panel-bg: #fff !default;
$panel-body-padding: 15px !default;
$panel-inner-border: #ddd !default;
$panel-footer-bg: #f5f5f5 !default;
$panel-default-text: $gray-dark !default;
$panel-default-border: #ddd !default;
$panel-default-heading-bg: #f5f5f5 !default;
$panel-primary-text: #fff !default;
$panel-primary-border: $brand-primary !default;
$panel-primary-heading-bg: $brand-primary !default;
$panel-success-text: $state-success-text !default;
$panel-success-border: $state-success-border !default;
$panel-success-heading-bg: $state-success-bg !default;
$panel-info-text: $state-info-text !default;
$panel-info-border: $state-info-border !default;
$panel-info-heading-bg: $state-info-bg !default;
$panel-warning-text: $state-warning-text !default;
$panel-warning-border: $state-warning-border !default;
$panel-warning-heading-bg: $state-warning-bg !default;
$panel-danger-text: $state-danger-text !default;
$panel-danger-border: $state-danger-border !default;
$panel-danger-heading-bg: $state-danger-bg !default;
// THUMBNAILS
$thumbnail-bg: $body-bg !default;
$thumbnail-border: #ddd !default;
$thumbnail-caption-color: $text-color !default;
// WELLS
$well-bg: #f5f5f5 !default;
$well-border: darken($well-bg, 7%) !default;
// BADGES
$badge-color: #fff !default;
$badge-link-hover-color: #fff !default;
$badge-bg: $gray-light !default;
$badge-active-color: $link-color !default;
$badge-active-bg: #fff !default;
// BREADCRUMBS
$breadcrumb-bg: #f5f5f5 !default;
$breadcrumb-color: #ccc !default;
$breadcrumb-active-color: $gray-light !default;
// CAROUSEL
$carousel-control-color: #fff !default;
$carousel-control-opacity: .5 !default;
$carousel-indicator-active-bg: #fff !default;
$carousel-indicator-border-color: #fff !default;
$carousel-caption-color: #fff !default;
// CLOSE
$close-color: #000 !default;
// CODE
$code-color: #c7254e !default;
$code-bg: #f9f2f4 !default;
$kbd-color: #fff !default;
$kbd-bg: #333 !default;
$pre-bg: #f5f5f5 !default;
$pre-color: $gray-dark !default;
$pre-border-color: #ccc !default;
// TYPE
$text-muted: $gray-light !default;
$abbr-border-color: $gray-light !default;
$headings-small-color: $gray-light !default;
$blockquote-small-color: $gray-light !default;
$blockquote-border-color: $gray-lighter !default;
$page-header-border-color: $gray-lighter !default;
$hr-border: $gray-lighter !default;