Skip to content

Commit f15e422

Browse files
#35 BG strips color config (#36)
1 parent c51509c commit f15e422

File tree

6 files changed

+40
-10
lines changed

6 files changed

+40
-10
lines changed

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3-
## 1.5.2 (2025-12-12)
3+
## 1.6.0 (TBD)
44

5+
- [#035] Added customizable background colors for breathing stripes
56
- [#033] Added close widget type to dismiss devbar
7+
8+
## 1.5.2 (2025-12-12)
9+
610
- [#027] Devbar template now includes its own CSS for self-contained styling
711
- [#029] Normalized uses CSS styles in both views
812

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ Include the devbar template in your base layout:
208208

209209
## Customization
210210

211+
### Background Colors
212+
213+
Customize the breathing stripes background colors in your `.disco-devbar.yaml`:
214+
215+
```yaml
216+
bg_color_light: '#b71c1c'
217+
bg_color_dark: '#8e0000'
218+
```
219+
211220
### Custom CSS
212221

213222
The bundle includes default styling. To customize, override the CSS after importing bundle assets or

Resources/public/devbar.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
left: 0;
66
right: 0;
77
z-index: 1001; /* Higher than top-nav (1000) to ensure it's above */
8-
background: #8e0000;
8+
background: var(--bg-color-dark, #8e0000);
99
color: white;
1010
font-size: 15px;
1111
overflow: hidden;
@@ -17,10 +17,10 @@
1717
inset: 0;
1818
background: repeating-linear-gradient(
1919
45deg,
20-
#b71c1c,
21-
#b71c1c 10px,
22-
#8e0000 10px,
23-
#8e0000 20px
20+
var(--bg-color-light, #b71c1c),
21+
var(--bg-color-light, #b71c1c) 10px,
22+
var(--bg-color-dark, #8e0000) 10px,
23+
var(--bg-color-dark, #8e0000) 20px
2424
);
2525
animation: breathe 6s ease-in-out infinite;
2626
}

Resources/views/devbar.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
crossorigin="anonymous"
1111
referrerpolicy="no-referrer" />
1212

13-
<div class="disco-devbar{% if banner_data.hasError %} disco-devbar-error{% endif %}">
13+
<div class="disco-devbar{% if banner_data.hasError %} disco-devbar-error{% endif %}" style="--bg-color-light: {{ banner_data.bgColorLight }}; --bg-color-dark: {{ banner_data.bgColorDark }}">
1414
<div class="disco-devbar-content">
1515
{% if banner_data.hasError %}
1616
<div class="disco-devbar-container-left">

src/Dto/DiscoDevBarData.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class DiscoDevBarData
3232
* @param string|null $version Bundle version (null shows as N/A)
3333
* @param bool $fontAwesomeEnabled Whether to auto-include Font Awesome
3434
* @param string $fontAwesomeVersion Font Awesome version to use
35+
* @param string $bgColorLight Light stripe color for background gradient
36+
* @param string $bgColorDark Dark stripe color for background gradient
3537
*/
3638
public function __construct(
3739
public readonly array $left,
@@ -42,7 +44,9 @@ public function __construct(
4244
public readonly string $errorMessage = '',
4345
public readonly ?string $version = null,
4446
public readonly bool $fontAwesomeEnabled = false,
45-
public readonly string $fontAwesomeVersion = '6.5.1'
47+
public readonly string $fontAwesomeVersion = '6.5.1',
48+
public readonly string $bgColorLight = '#b71c1c',
49+
public readonly string $bgColorDark = '#8e0000'
4650
) {
4751
}
4852
}

src/Service/DiscoDevBarService.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class DiscoDevBarService
4141
*/
4242
private const DEFAULT_FONT_AWESOME_VERSION = '6.5.1';
4343

44+
/**
45+
* Default background colors for breathing stripes
46+
*/
47+
private const DEFAULT_BG_COLOR_LIGHT = '#b71c1c';
48+
private const DEFAULT_BG_COLOR_DARK = '#8e0000';
49+
4450
public function __construct(
4551
private readonly string $projectDir
4652
) {
@@ -63,7 +69,9 @@ public function getDiscoDevBarData(): DiscoDevBarData
6369
errorMessage: $errorMessage,
6470
version: $version,
6571
fontAwesomeEnabled: false,
66-
fontAwesomeVersion: self::DEFAULT_FONT_AWESOME_VERSION
72+
fontAwesomeVersion: self::DEFAULT_FONT_AWESOME_VERSION,
73+
bgColorLight: self::DEFAULT_BG_COLOR_LIGHT,
74+
bgColorDark: self::DEFAULT_BG_COLOR_DARK
6775
);
6876
}
6977

@@ -99,6 +107,9 @@ public function getDiscoDevBarData(): DiscoDevBarData
99107
$leftWidgets = $this->loadWidgets(\is_array($left) ? $left : []);
100108
$rightWidgets = $this->loadWidgets(\is_array($right) ? $right : []);
101109

110+
$bgColorLight = $config['bg_color_light'] ?? self::DEFAULT_BG_COLOR_LIGHT;
111+
$bgColorDark = $config['bg_color_dark'] ?? self::DEFAULT_BG_COLOR_DARK;
112+
102113
return new DiscoDevBarData(
103114
left: $leftWidgets,
104115
right: $rightWidgets,
@@ -108,7 +119,9 @@ public function getDiscoDevBarData(): DiscoDevBarData
108119
errorMessage: '',
109120
version: $version,
110121
fontAwesomeEnabled: \is_bool($fontAwesomeEnabled) ? $fontAwesomeEnabled : false,
111-
fontAwesomeVersion: $fontAwesomeVersion
122+
fontAwesomeVersion: $fontAwesomeVersion,
123+
bgColorLight: \is_string($bgColorLight) ? $bgColorLight : self::DEFAULT_BG_COLOR_LIGHT,
124+
bgColorDark: \is_string($bgColorDark) ? $bgColorDark : self::DEFAULT_BG_COLOR_DARK
112125
);
113126
}
114127

0 commit comments

Comments
 (0)