From 23cdd9d862f29eb43bec86df4b492908806ad396 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 17 Jan 2021 00:06:19 +0200 Subject: [PATCH 1/2] Update docs for color and bg utilities - Split colors from background utilities with new docs page - Add Sass docs for both pages --- scss/_utilities.scss | 6 ++ scss/_variables.scss | 10 +++ scss/mixins/_gradients.scss | 4 + site/content/docs/5.0/components/card.md | 2 +- site/content/docs/5.0/components/navbar.md | 2 +- site/content/docs/5.0/components/toasts.md | 2 +- site/content/docs/5.0/customize/color.md | 2 +- .../content/docs/5.0/helpers/colored-links.md | 2 +- site/content/docs/5.0/utilities/background.md | 78 +++++++++++++++++++ site/content/docs/5.0/utilities/colors.md | 69 ++++++++-------- site/content/docs/5.0/utilities/display.md | 8 ++ site/data/sidebar.yml | 1 + 12 files changed, 147 insertions(+), 39 deletions(-) create mode 100644 site/content/docs/5.0/utilities/background.md diff --git a/scss/_utilities.scss b/scss/_utilities.scss index 89bf16847b17..82f3db114995 100644 --- a/scss/_utilities.scss +++ b/scss/_utilities.scss @@ -22,6 +22,7 @@ $utilities: map-merge( property: overflow, values: auto hidden visible scroll, ), + // scss-docs-start utils-display "display": ( responsive: true, print: true, @@ -29,6 +30,7 @@ $utilities: map-merge( class: d, values: inline inline-block block grid table table-row table-cell flex inline-flex none ), + // scss-docs-end utils-display "shadow": ( property: box-shadow, class: shadow, @@ -440,6 +442,7 @@ $utilities: map-merge( center: center, ) ), + // scss-docs-start utils-color "color": ( property: color, class: text, @@ -455,6 +458,7 @@ $utilities: map-merge( ) ) ), + // scss-docs-end utils-color "line-height": ( property: line-height, class: lh, @@ -465,6 +469,7 @@ $utilities: map-merge( lg: $line-height-lg, ) ), + // scss-docs-start utils-bg-color "background-color": ( property: background-color, class: bg, @@ -477,6 +482,7 @@ $utilities: map-merge( ) ) ), + // scss-docs-end utils-bg-color "gradient": ( property: background-image, class: bg, diff --git a/scss/_variables.scss b/scss/_variables.scss index 3ad989a4196c..3f8014497825 100644 --- a/scss/_variables.scss +++ b/scss/_variables.scss @@ -5,6 +5,7 @@ // Color system +// scss-docs-start gray-color-variables $white: #fff !default; $gray-100: #f8f9fa !default; $gray-200: #e9ecef !default; @@ -16,8 +17,10 @@ $gray-700: #495057 !default; $gray-800: #343a40 !default; $gray-900: #212529 !default; $black: #000 !default; +// scss-docs-end gray-color-variables // fusv-disable +// scss-docs-start gray-colors-map $grays: ( "100": $gray-100, "200": $gray-200, @@ -29,8 +32,10 @@ $grays: ( "800": $gray-800, "900": $gray-900 ) !default; +// scss-docs-end gray-colors-map // fusv-enable +// scss-docs-start color-variables $blue: #0d6efd !default; $indigo: #6610f2 !default; $purple: #6f42c1 !default; @@ -41,6 +46,7 @@ $yellow: #ffc107 !default; $green: #198754 !default; $teal: #20c997 !default; $cyan: #0dcaf0 !default; +// scss-docs-end color-variables // scss-docs-start colors-map $colors: ( @@ -60,6 +66,7 @@ $colors: ( ) !default; // scss-docs-end colors-map +// scss-docs-start theme-color-variables $primary: $blue !default; $secondary: $gray-600 !default; $success: $green !default; @@ -68,6 +75,7 @@ $warning: $yellow !default; $danger: $red !default; $light: $gray-100 !default; $dark: $gray-900 !default; +// scss-docs-end theme-color-variables // scss-docs-start theme-colors-map $theme-colors: ( @@ -228,7 +236,9 @@ $variable-prefix: bs- !default; // // The gradient which is added to components if `$enable-gradients` is `true` // This gradient is also added to elements with `.bg-gradient` +// scss-docs-start variable-gradient $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0)) !default; +// scss-docs-end variable-gradient // Spacing // diff --git a/scss/mixins/_gradients.scss b/scss/mixins/_gradients.scss index ec38ca1417ff..44167d1b8b29 100644 --- a/scss/mixins/_gradients.scss +++ b/scss/mixins/_gradients.scss @@ -1,5 +1,6 @@ // Gradients +// scss-docs-start gradient-bg-mixin @mixin gradient-bg($color: null) { background-color: $color; @@ -7,7 +8,9 @@ background-image: var(--#{$variable-prefix}gradient); } } +// scss-docs-end gradient-bg-mixin +// scss-docs-start gradient-mixins // Horizontal gradient, from left to right // // Creates two color stops, start and end, by specifying a color and position for each color stop. @@ -41,3 +44,4 @@ @mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) { background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent); } +// scss-docs-end gradient-mixins diff --git a/site/content/docs/5.0/components/card.md b/site/content/docs/5.0/components/card.md index e384326928ac..2db1a1f40d23 100644 --- a/site/content/docs/5.0/components/card.md +++ b/site/content/docs/5.0/components/card.md @@ -417,7 +417,7 @@ Cards include various options for customizing their backgrounds, borders, and co ### Background and color -Use [text and background utilities]({{< docsref "/utilities/colors" >}}) to change the appearance of a card. +Use [text color]({{< docsref "/utilities/colors" >}}) and [background utilities]({{< docsref "/utilities/background" >}}) to change the appearance of a card. {{< example >}} {{< card.inline >}} diff --git a/site/content/docs/5.0/components/navbar.md b/site/content/docs/5.0/components/navbar.md index 3591b343cd71..b9b00c3bb193 100644 --- a/site/content/docs/5.0/components/navbar.md +++ b/site/content/docs/5.0/components/navbar.md @@ -74,7 +74,7 @@ Here's an example of all the sub-components included in a responsive light-theme {{< /example >}} -This example uses [color]({{< docsref "/utilities/colors" >}}) (`bg-light`) and [spacing]({{< docsref "/utilities/spacing" >}}) (`my-2`, `my-lg-0`, `me-sm-0`, `my-sm-0`) utility classes. +This example uses [background]({{< docsref "/utilities/background" >}}) (`bg-light`) and [spacing]({{< docsref "/utilities/spacing" >}}) (`my-2`, `my-lg-0`, `me-sm-0`, `my-sm-0`) utility classes. ### Brand diff --git a/site/content/docs/5.0/components/toasts.md b/site/content/docs/5.0/components/toasts.md index eb879b650036..5f7a59db6e8e 100644 --- a/site/content/docs/5.0/components/toasts.md +++ b/site/content/docs/5.0/components/toasts.md @@ -162,7 +162,7 @@ Alternatively, you can also add additional controls and components to toasts. ### Color schemes -Building on the above example, you can create different toast color schemes with our [color utilities]({{< docsref "/utilities/colors" >}}). Here we've added `.bg-primary` and `.text-white` to the `.toast`, and then added `.btn-close-white` to our close button. For a crisp edge, we remove the default border with `.border-0`. +Building on the above example, you can create different toast color schemes with our [color]({{< docsref "/utilities/colors" >}}) and [background]({{< docsref "/utilities/background" >}}). Here we've added `.bg-primary` and `.text-white` to the `.toast`, and then added `.btn-close-white` to our close button. For a crisp edge, we remove the default border with `.border-0`. {{< example class="bg-light" >}}