Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

## 1.5.2 (2025-12-12)
## 1.6.0 (TBD)

- [#035] Added customizable background colors for breathing stripes
- [#033] Added close widget type to dismiss devbar

## 1.5.2 (2025-12-12)

- [#027] Devbar template now includes its own CSS for self-contained styling
- [#029] Normalized uses CSS styles in both views

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ Include the devbar template in your base layout:

## Customization

### Background Colors

Customize the breathing stripes background colors in your `.disco-devbar.yaml`:

```yaml
bg_color_light: '#b71c1c'
bg_color_dark: '#8e0000'
```

### Custom CSS

The bundle includes default styling. To customize, override the CSS after importing bundle assets or
Expand Down
10 changes: 5 additions & 5 deletions Resources/public/devbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
left: 0;
right: 0;
z-index: 1001; /* Higher than top-nav (1000) to ensure it's above */
background: #8e0000;
background: var(--bg-color-dark, #8e0000);
color: white;
font-size: 15px;
overflow: hidden;
Expand All @@ -17,10 +17,10 @@
inset: 0;
background: repeating-linear-gradient(
45deg,
#b71c1c,
#b71c1c 10px,
#8e0000 10px,
#8e0000 20px
var(--bg-color-light, #b71c1c),
var(--bg-color-light, #b71c1c) 10px,
var(--bg-color-dark, #8e0000) 10px,
var(--bg-color-dark, #8e0000) 20px
);
animation: breathe 6s ease-in-out infinite;
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/devbar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
crossorigin="anonymous"
referrerpolicy="no-referrer" />

<div class="disco-devbar{% if banner_data.hasError %} disco-devbar-error{% endif %}">
<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 }}">
<div class="disco-devbar-content">
{% if banner_data.hasError %}
<div class="disco-devbar-container-left">
Expand Down
6 changes: 5 additions & 1 deletion src/Dto/DiscoDevBarData.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class DiscoDevBarData
* @param string|null $version Bundle version (null shows as N/A)
* @param bool $fontAwesomeEnabled Whether to auto-include Font Awesome
* @param string $fontAwesomeVersion Font Awesome version to use
* @param string $bgColorLight Light stripe color for background gradient
* @param string $bgColorDark Dark stripe color for background gradient
*/
public function __construct(
public readonly array $left,
Expand All @@ -42,7 +44,9 @@ public function __construct(
public readonly string $errorMessage = '',
public readonly ?string $version = null,
public readonly bool $fontAwesomeEnabled = false,
public readonly string $fontAwesomeVersion = '6.5.1'
public readonly string $fontAwesomeVersion = '6.5.1',
public readonly string $bgColorLight = '#b71c1c',
public readonly string $bgColorDark = '#8e0000'
) {
}
}
17 changes: 15 additions & 2 deletions src/Service/DiscoDevBarService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class DiscoDevBarService
*/
private const DEFAULT_FONT_AWESOME_VERSION = '6.5.1';

/**
* Default background colors for breathing stripes
*/
private const DEFAULT_BG_COLOR_LIGHT = '#b71c1c';
private const DEFAULT_BG_COLOR_DARK = '#8e0000';

public function __construct(
private readonly string $projectDir
) {
Expand All @@ -63,7 +69,9 @@ public function getDiscoDevBarData(): DiscoDevBarData
errorMessage: $errorMessage,
version: $version,
fontAwesomeEnabled: false,
fontAwesomeVersion: self::DEFAULT_FONT_AWESOME_VERSION
fontAwesomeVersion: self::DEFAULT_FONT_AWESOME_VERSION,
bgColorLight: self::DEFAULT_BG_COLOR_LIGHT,
bgColorDark: self::DEFAULT_BG_COLOR_DARK
);
}

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

$bgColorLight = $config['bg_color_light'] ?? self::DEFAULT_BG_COLOR_LIGHT;
$bgColorDark = $config['bg_color_dark'] ?? self::DEFAULT_BG_COLOR_DARK;

return new DiscoDevBarData(
left: $leftWidgets,
right: $rightWidgets,
Expand All @@ -108,7 +119,9 @@ public function getDiscoDevBarData(): DiscoDevBarData
errorMessage: '',
version: $version,
fontAwesomeEnabled: \is_bool($fontAwesomeEnabled) ? $fontAwesomeEnabled : false,
fontAwesomeVersion: $fontAwesomeVersion
fontAwesomeVersion: $fontAwesomeVersion,
bgColorLight: \is_string($bgColorLight) ? $bgColorLight : self::DEFAULT_BG_COLOR_LIGHT,
bgColorDark: \is_string($bgColorDark) ? $bgColorDark : self::DEFAULT_BG_COLOR_DARK
);
}

Expand Down
Loading