Skip to content

Commit 851e3e5

Browse files
authored
Improve avatars in high contrast mode (#10427)
2 parents 5a61154 + 292ded3 commit 851e3e5

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/main/js/components/command-palette/models.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function LinkResult(params) {
1919
return `<a class="jenkins-command-palette__results__item" href="${xmlEscape(
2020
params.url,
2121
)}">
22-
${params.type === "image" ? `<img alt="${xmlEscape(params.label)}" class="jenkins-command-palette__results__item__icon" src="${params.icon}" />` : ""}
22+
${params.type === "image" ? `<img alt="${xmlEscape(params.label)}" class="jenkins-command-palette__results__item__icon jenkins-avatar" src="${params.icon}" />` : ""}
2323
${params.type !== "image" ? `<div class="jenkins-command-palette__results__item__icon">${params.icon}</div>` : ""}
2424
${xmlEscape(params.label)}
2525
${params.isExternal ? Symbols.EXTERNAL_LINK : ""}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
.jenkins-avatar {
22
&[src] {
33
border-radius: 100px;
4-
outline: 1px solid color-mix(in sRGB, var(--text-color) 10%, transparent);
5-
background: color-mix(in sRGB, var(--text-color) 5%, transparent);
6-
outline-offset: -1px;
4+
outline: var(--jenkins-border-width) solid
5+
color-mix(in sRGB, var(--text-color-secondary) 10%, transparent);
6+
background: color-mix(in sRGB, var(--text-color-secondary) 5%, transparent);
7+
outline-offset: calc(var(--jenkins-border-width) * -1);
8+
object-fit: cover;
9+
10+
@media (prefers-contrast: more) {
11+
outline-color: var(--text-color);
12+
}
713
}
814
}

src/main/scss/components/_command-palette.scss

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,6 @@ $command-palette-background: color-mix(
186186
width: 1.25rem;
187187
height: 1.25rem;
188188
}
189-
190-
&[src] {
191-
border-radius: 100px;
192-
outline: 1px solid
193-
color-mix(in sRGB, var(--text-color) 10%, transparent);
194-
background: color-mix(in sRGB, var(--text-color) 5%, transparent);
195-
outline-offset: -1px;
196-
}
197189
}
198190

199191
&__description {

0 commit comments

Comments
 (0)