Skip to content

Commit 2fb169b

Browse files
committed
CSS: Use inlined SVG masks for button icons instead of htmlentities
1 parent 39c0a5f commit 2fb169b

File tree

8 files changed

+39
-18
lines changed

8 files changed

+39
-18
lines changed

build/kint.phar

6.24 KB
Binary file not shown.

resources/compiled/aante-dark.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/compiled/aante-light.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/compiled/original.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/compiled/solarized-dark.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/compiled/solarized.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/sass/_base.scss

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
--foldout-zindex: 999999;
2121

2222
--caret-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 150'><g stroke-width='2' fill='%23FFF'><path d='M1 1h28v28H1zm5 14h18m-9 9V6M1 61h28v28H1zm5 14h18' stroke='%23379'/><path d='M1 31h28v28H1zm5 14h18m-9 9V36M1 91h28v28H1zm5 14h18' stroke='%235A3'/><path d='M1 121h28v28H1zm5 5l18 18m-18 0l18-18' stroke='%23CCC'/></g></svg>");
23+
--ap-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><g stroke='%23000' fill='transparent'><path d='M2 8h3m3 3v3M8 2v3m3 3h3M3 8' stroke-width='2' stroke-linecap='round'/><circle stroke-width='1.5' r='4.5' cx='8' cy='8'/></g></svg>");
24+
--folder-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M2 2h4l2 2h6v9H2V2h2' stroke-width='2' stroke='%23000' fill='transparent' stroke-linejoin='round'/></svg>");
25+
--search-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><g stroke='%23000' fill='transparent'><path d='M2 14l3-3' stroke-linecap='round' stroke-width='3'/><circle stroke-width='2' r='5' cx='9' cy='7'/></g></svg>");
2326

2427
font-size: 13px;
2528
overflow-x: auto;
@@ -196,6 +199,7 @@
196199
.kint-search-trigger {
197200
background: color-mix(in srgb, var(--text-color) 80%, transparent);
198201
border-radius: 3px;
202+
padding: 2px;
199203
height: var(--nav-size);
200204
width: var(--nav-size);
201205
font-size: var(--nav-size);
@@ -205,23 +209,37 @@
205209
line-height: 1;
206210
float: right !important;
207211
cursor: pointer;
208-
color: var(--main-background);
209212
position: relative;
210213
overflow: hidden;
211-
display: flex;
212-
align-items: center;
213-
justify-content: center;
214+
215+
&::before {
216+
display: block;
217+
content: "";
218+
width: 100%;
219+
height: 100%;
220+
background: var(--main-background);
221+
mask: center/contain no-repeat alpha;
222+
}
214223

215224
&:hover {
216-
color: var(--text-color);
217225
background: var(--main-background);
226+
227+
&::before {
228+
background: var(--text-color);
229+
}
218230
}
219231
}
220232

221-
// The &telrec; icon is slightly smaller than the others,
222-
// so make it a bit bigger to line it out better
223-
.kint-search-trigger {
224-
font-size: calc(var(--nav-size) * 1.25);
233+
.kint-access-path-trigger::before {
234+
mask-image: var(--ap-image);
235+
}
236+
237+
.kint-folder-trigger::before {
238+
mask-image: var(--folder-image);
239+
}
240+
241+
.kint-search-trigger::before {
242+
mask-image: var(--search-image);
225243
}
226244

227245
input.kint-search {
@@ -283,7 +301,10 @@
283301

284302
> .kint-folder-trigger {
285303
background: transparent;
286-
color: var(--text-color);
304+
305+
&::before {
306+
background: var(--text-color);
307+
}
287308
}
288309

289310
nav {

src/Renderer/RichRenderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,15 @@ public function renderHeaderWrapper(ContextInterface $c, bool $has_children, str
221221
$out .= '>';
222222

223223
if (self::$access_paths && $c->getDepth() > 0 && null !== ($ap = $c->getAccessPath())) {
224-
$out .= '<span class="kint-access-path-trigger" title="Show access path">&rlarr;</span>';
224+
$out .= '<span class="kint-access-path-trigger" title="Show access path"></span>';
225225
}
226226

227227
if ($has_children) {
228228
if (0 === $c->getDepth()) {
229229
if (!$this->use_folder) {
230-
$out .= '<span class="kint-folder-trigger" title="Move to folder">&mapstodown;</span>';
230+
$out .= '<span class="kint-folder-trigger" title="Move to folder"></span>';
231231
}
232-
$out .= '<span class="kint-search-trigger" title="Show search box">&telrec;</span>';
232+
$out .= '<span class="kint-search-trigger" title="Show search box"></span>';
233233
$out .= '<input type="text" class="kint-search" value="">';
234234
}
235235

0 commit comments

Comments
 (0)