Skip to content

Commit ff9d297

Browse files
committed
Use an SVG as the main icon for the debug bar
1 parent 343191d commit ff9d297

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/Views/debugbar/debugbar.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if (!isset($options['info_contents'])) {
1212
$options['info_contents'] = '<p>★ <a href="https://aplus-framework.com" target="_blank">aplus-framework.com</a></p>';
1313
}
14-
$iconPath = __DIR__ . '/icon.png';
14+
$iconPath = __DIR__ . '/icon.svg';
1515
if (isset($options['icon_path'])) {
1616
$iconPath = $options['icon_path'];
1717
}
@@ -130,7 +130,12 @@ class_exists('Aplus')
130130
</div>
131131
<div class="toolbar">
132132
<div class="icon">
133-
<img src="data:image/png;base64,<?= base64_encode((string) file_get_contents($iconPath)) ?>" alt="A+" width="32" height="32">
133+
<?php $contents = (string) file_get_contents($iconPath) ?>
134+
<?php if(str_ends_with($iconPath, '.svg')) : ?>
135+
<?= strtr($contents, ['<svg ' => '<svg width="32" height="32" ']) ?>
136+
<?php else : ?>
137+
<img src="data:image/png;base64,<?= base64_encode($contents) ?>" alt="A+" width="32" height="32">
138+
<?php endif ?>
134139
</div>
135140
<div class="collections">
136141
<?php foreach ($collections as $collection): ?>

src/Views/debugbar/icon.svg

Lines changed: 1 addition & 0 deletions
Loading

tests/DebuggerTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ public function testIconPathOption() : void
248248
);
249249
}
250250

251+
public function testDefaultIconPath() : void
252+
{
253+
self::assertStringContainsString(
254+
'<svg width="32" height="32" ',
255+
$this->debugger->renderDebugbar()
256+
);
257+
}
258+
251259
protected function closeBuffer() : void
252260
{
253261
if (\ob_get_level()) {

0 commit comments

Comments
 (0)