Skip to content

Commit 03ae6f1

Browse files
authored
chore: fix search result color (#22962)
Some parts of the search results window are hard to read. Let's fix this. Before: see live website After: ![Screenshot 2025-07-01 at 12 45 40](https://github.com/user-attachments/assets/34e8e10c-d2ab-4c8b-9d83-07299915464e) ![Screenshot 2025-07-01 at 12 45 49](https://github.com/user-attachments/assets/a851dcdb-5423-40bc-9a8b-19cd949c408c)
1 parent 266da0b commit 03ae6f1

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

assets/css/global.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,9 @@ input[type="search"]::-ms-clear {
9595
.navbar-group:first-of-type {
9696
margin-top: 0.2rem !important;
9797
}
98+
99+
#search-page-results {
100+
mark:where(.dark, .dark *) {
101+
color: var(--color-blue-400);
102+
}
103+
}

assets/css/utilities.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,7 @@
253253
@utility chip {
254254
@apply border-divider-light dark:border-divider-dark inline-flex items-center gap-1 rounded-full border bg-gray-100 px-2 text-sm text-gray-800 select-none dark:bg-gray-700 dark:text-gray-200;
255255
}
256+
257+
@utility pagination-link {
258+
@apply flex items-center justify-center rounded-sm p-2;
259+
}

layouts/_default/search.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ <h1 class="py-4">{{ .Title }}</h1>
133133
}
134134

135135
// Generate the search results HTML
136-
let resultsHTML = `<div class="text-gray-200 dark:text-gray-500 p-2">${resultsLength} results</div>`;
136+
let resultsHTML = `<div class="text-gray-400 dark:text-gray-500 p-2">${resultsLength} results</div>`;
137137

138138
// Map results to HTML
139139
resultsHTML += results
140140
.map((item) => {
141141
return `<div class="p-4">
142142
<div class="flex flex-col">
143-
<span class="text-gray-200 dark:texty-gray-dark text-sm">${item.meta.breadcrumbs}</span>
143+
<span class="text-gray-400 dark:texty-gray-dark text-sm">${item.meta.breadcrumbs}</span>
144144
<a class="link" href="${item.url}" data-query="${query}" data-index="${item.index}">${item.meta.title}</a>
145145
<p class="text-black dark:text-white overflow-hidden">…${item.excerpt}…</p>
146146
</div>
@@ -153,12 +153,12 @@ <h1 class="py-4">{{ .Title }}</h1>
153153
resultsHTML += `<ul class="flex flex-wrap gap-1 pt-4 pb-8 justify-center text-sm">`;
154154
for (let i = 1; i <= resultsLength / 10; i++) {
155155
if (i == currentPage) {
156-
resultsHTML += `<li class="text-center text-white">
157-
<a href="/search/?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-blue-light dark:bg-blue-dark">${i}</a>
156+
resultsHTML += `<li class="flex items-center justify-center">
157+
<a href="/search/?q=${query}&page=${i}" class="pagination-link bg-gray-200 dark:bg-gray-800 dark:text-gray-200">${i}</a>
158158
</li>`;
159159
} else {
160-
resultsHTML += `<li class="text-center text-gray-200 dark:text-gray-500">
161-
<a href="/search/?q=${query}&page=${i}" class="block h-6 w-6 rounded-sm bg-gray-200 dark:bg-gray-800">${i}</a>
160+
resultsHTML += `<li class="flex items-center justify-center">
161+
<a href="/search/?q=${query}&page=${i}" class="pagination-link bg-gray-100 dark:bg-gray-900 dark:text-gray-400">${i}</a>
162162
</li>`;
163163
}
164164
}

layouts/partials/search-bar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
searchBarResults.classList.add("hidden");
105105
}
106106

107-
let resultsHTML = `<div class="p-2 text-gray-200 dark:text-gray-500">${resultsLength} results</div>`;
107+
let resultsHTML = `<div class="p-2 text-gray-400 dark:text-gray-500">${resultsLength} results</div>`;
108108
resultsHTML += results
109109
.map((item) => {
110110
return `<div class="p-2">

0 commit comments

Comments
 (0)