Skip to content

Commit afef5eb

Browse files
Dark mode: Title bars (#2350)
Co-authored-by: Julien Déramond <julien.deramond@orange.com>
1 parent b26f703 commit afef5eb

File tree

5 files changed

+75
-19
lines changed

5 files changed

+75
-19
lines changed

scss/_title-bars.scss

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.title-bar {
22
// scss-docs-start title-bar-css-vars
3+
--#{$prefix}title-bar-bg: #{$title-bar-bg};
4+
--#{$prefix}title-bar-color: #{$title-bar-color};
35
--#{$prefix}title-bar-image-ratio: #{$title-bar-image-ratio};
46
--#{$prefix}title-bar-padding-y: #{$title-bar-padding-y};
57
--#{$prefix}title-bar-font-size: #{$title-bar-font-size};
@@ -9,6 +11,8 @@
911
--#{$prefix}title-bar-border-color: #{$title-bar-border-color};
1012
// scss-docs-end title-bar-css-vars
1113

14+
color: var(--#{$prefix}title-bar-color);
15+
background-color: var(--#{$prefix}title-bar-bg);
1216
border-bottom: var(--#{$prefix}title-bar-border-width) solid var(--#{$prefix}title-bar-border-color);
1317

1418
@include media-breakpoint-up(md) {
@@ -21,11 +25,6 @@
2125
--#{$prefix}title-bar-letter-spacing: #{$title-bar-letter-spacing-xl};
2226
}
2327

24-
&.bg-dark,
25-
&.bg-secondary {
26-
--#{$prefix}title-bar-border-color: #{$title-bar-border-color-dark};
27-
}
28-
2928
> [class*="container"] {
3029
display: flex;
3130
align-items: flex-end;

scss/_variables.scss

+6-2
Original file line numberDiff line numberDiff line change
@@ -2065,21 +2065,25 @@ $figure-caption-color: $gray-900 !default; // Boosted mod: instead
20652065
// Title bars
20662066

20672067
// scss-docs-start title-bars-variables
2068+
$title-bar-bg: var(--#{$prefix}body-bg) !default;
2069+
$title-bar-color: var(--#{$prefix}body-color) !default;
20682070
$title-bar-image-ratio: 1.8em !default;
20692071
$title-bar-padding-y: .3333333em !default;
20702072
$title-bar-font-size: $h2-font-size !default;
20712073
$title-bar-line-height: $display-line-height !default;
20722074
$title-bar-letter-spacing: $h2-spacing !default;
20732075
$title-bar-border-width: calc(var(--#{$prefix}border-width) * .5) !default; // stylelint-disable-line function-disallowed-list
2074-
$title-bar-border-color: $gray-500 !default;
2076+
$title-bar-border-color: var(--#{$prefix}border-color-translucent) !default;
20752077

20762078
$title-bar-font-size-md: $display2-size !default;
20772079
$title-bar-letter-spacing-md: $display2-spacing !default;
20782080

20792081
$title-bar-font-size-xl: $display1-size !default;
20802082
$title-bar-letter-spacing-xl: $display1-spacing !default;
20812083

2082-
$title-bar-border-color-dark: $gray-700 !default;
2084+
// fusv-disable
2085+
$title-bar-border-color-dark: $gray-700 !default; // Deprecated in v5.3.3
2086+
// fusv-enable
20832087
// scss-docs-end title-bars-variables
20842088
// End mod
20852089

site/content/docs/5.3/components/title-bars.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,32 @@ See them in action in our [examples page]({{<docsref "/examples/title-bars">}}).
1919

2020
## Background color
2121

22-
To change the appearance of a title bar, use our [background utilities]({{<docsref "/utilities/background">}}). Orange branded background utilities are `.bg-dark`, `.bg-white` and `.bg-supporting-*`.'
22+
To change the appearance of a title bar, use our [background utilities]({{<docsref "/utilities/background">}}). Orange branded background utilities are `.bg-dark`, `.bg-white` and `.bg-supporting-*`.
23+
24+
Title bars can be displayed with `.bg-black`, `.bg-dark`, `.bg-white` or with the default background color. When using `.bg-black`, `.bg-dark`, `.bg-white` or the default background color, illustrations can be included as an option, but it's not necessary.
2325

24-
Title bars can be displayed with black or white backgrounds. When using black or white backgrounds, illustrations can be included as an option, but it's not necessary.
2526
Supporting colors can also be used as the background color for title bars, but not the supporting light and dark tint colors. When using one of the supporting colors, illustrations must be used.
2627

27-
The image should not overlap on title and the title shouldn't wrap. If this happens, please **transform your title bar** into a white/black one without any image.
28+
The image should not overlap on title and the title shouldn't wrap. If this happens, please transform your title bar into a title bar with `.bg-black`, `.bg-dark`, `.bg-white` or with the default background color without any image.
2829

2930
{{< example class="p-0">}}
30-
<div class="bg-body title-bar">
31+
<div class="title-bar">
3132
<div class="container-xxl">
3233
<h1 class="display-1">Title</h1>
3334
</div>
3435
</div>
3536

3637
<div class="mt-3"></div>
3738

38-
<div class="bg-dark title-bar">
39+
<div class="bg-dark title-bar" data-bs-theme="dark">
3940
<div class="container-xxl">
4041
<h1 class="display-1">Title</h1>
4142
</div>
4243
</div>
4344

4445
<div class="mt-3"></div>
4546

46-
<div class="bg-supporting-green title-bar">
47+
<div class="bg-supporting-green title-bar" data-bs-theme="light">
4748
<div class="container-xxl">
4849
<h1 class="display-1">Title</h1>
4950
<picture>
@@ -68,7 +69,7 @@ Several options are available to add an image in a title bar.
6869
We **strongly recommend** to use `srcset` attribute as it is [well supported](https://caniuse.com/srcset) by browsers and allows you to load an image depending on the user's device. However, it might introduce a delay to display the image while resizing.
6970

7071
{{< example class="p-0">}}
71-
<div class="bg-supporting-pink title-bar">
72+
<div class="bg-supporting-pink title-bar" data-bs-theme="light">
7273
<div class="container-xxl">
7374
<h1 class="display-1">Title</h1>
7475
<picture>
@@ -87,7 +88,7 @@ We **strongly recommend** to use `srcset` attribute as it is [well supported](ht
8788
### HTML `<svg>` tag
8889

8990
{{< example class="p-0">}}
90-
<div class="bg-supporting-purple title-bar">
91+
<div class="bg-supporting-purple title-bar" data-bs-theme="light">
9192
<div class="container-xxl">
9293
<h1 class="display-1">Title</h1>
9394
<svg aria-hidden="true" focusable="false" width="1.8em"><use xlink:href="/docs/{{< param docs_version >}}/assets/img/boosted-sprite.svg#document"/></svg>
@@ -98,7 +99,7 @@ We **strongly recommend** to use `srcset` attribute as it is [well supported](ht
9899
### HTML `<img>` tag
99100

100101
{{< example class="p-0">}}
101-
<div class="bg-supporting-green title-bar">
102+
<div class="bg-supporting-green title-bar" data-bs-theme="light">
102103
<div class="container-xxl">
103104
<h1 class="display-1">Title</h1>
104105
<img src="/docs/{{< param docs_version >}}/assets/img/title-bars-illustrations/illustration-320.png" alt="" class="d-sm-none">

site/content/docs/5.3/dark-mode.md

+52
Original file line numberDiff line numberDiff line change
@@ -5158,6 +5158,58 @@ sitemap_exclude: true
51585158
</ul>
51595159
</div>
51605160

5161+
### Title bars
5162+
5163+
<h4 class="mt-3">No theme</h4>
5164+
5165+
<div class="border border-tertiary p-3">
5166+
<div class="title-bar">
5167+
<div class="container-xxl">
5168+
<h1 class="display-1">Title</h1>
5169+
</div>
5170+
</div>
5171+
</div>
5172+
5173+
<h4 class="mt-3">Dark theme on container</h4>
5174+
5175+
<div class="border border-tertiary p-3 bg-body" data-bs-theme="dark">
5176+
<div class="title-bar">
5177+
<div class="container-xxl">
5178+
<h1 class="display-1">Title</h1>
5179+
</div>
5180+
</div>
5181+
</div>
5182+
5183+
<h4 class="mt-3">Light theme on container</h4>
5184+
5185+
<div class="border border-tertiary p-3 bg-body" data-bs-theme="light">
5186+
<div class="title-bar">
5187+
<div class="container-xxl">
5188+
<h1 class="display-1">Title</h1>
5189+
</div>
5190+
</div>
5191+
</div>
5192+
5193+
<h4 class="mt-3">Dark theme on component</h4>
5194+
5195+
<div class="border border-tertiary p-3" style="background-color: #282d55;">
5196+
<div class="title-bar" data-bs-theme="dark">
5197+
<div class="container-xxl">
5198+
<h1 class="display-1">Title</h1>
5199+
</div>
5200+
</div>
5201+
</div>
5202+
5203+
<h4 class="mt-3">Light theme on component</h4>
5204+
5205+
<div class="border border-tertiary p-3" style="background-color: #b5e8f7">
5206+
<div class="title-bar" data-bs-theme="light">
5207+
<div class="container-xxl">
5208+
<h1 class="display-1">Title</h1>
5209+
</div>
5210+
</div>
5211+
</div>
5212+
51615213
### Tooltips
51625214

51635215
<h4 class="mt-3">No theme</h4>

site/content/docs/5.3/examples/title-bars/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
---
1212

1313
<main>
14-
<div class="bg-body title-bar">
14+
<div class="title-bar">
1515
<div class="container-xxl">
1616
<h1 class="display-1">Title</h1>
1717
</div>
1818
</div>
1919

2020
<div class="b-example-divider"></div>
2121

22-
<div class="bg-supporting-pink title-bar">
22+
<div class="bg-supporting-pink title-bar" data-bs-theme="light">
2323
<div class="container-xxl">
2424
<h1 class="display-1">Title</h1>
2525
<picture>
@@ -46,7 +46,7 @@ <h4 class="alert-heading">Background image</h4>
4646

4747
<div class="b-example-divider"></div>
4848

49-
<div class="bg-supporting-blue title-bar">
49+
<div class="bg-supporting-blue title-bar" data-bs-theme="light">
5050
<div class="container-xxl">
5151
<h1 class="display-1">Title</h1>
5252
<div class="col example-title-bar-custom-background"></div>

0 commit comments

Comments
 (0)