Skip to content

Commit 4c262e1

Browse files
authored
Use brighness for links, opacity for monochrome icons. (#8528)
1 parent f66a38b commit 4c262e1

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

app/lib/frontend/templates/views/pkg/versions/version_row.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ d.Node versionRowNode(
6060
rel: 'nofollow',
6161
title: 'Download $package ${version.version} archive',
6262
child: d.img(
63-
classes: ['version-table-icon', 'filter-invert-on-dark'],
63+
classes: ['pub-monochrome-icon', 'filter-invert-on-dark'],
6464
image: d.Image(
6565
src: staticUrls.downloadIcon,
6666
alt: 'Download $package ${version.version} archive',
@@ -91,7 +91,7 @@ d.Node _documentationCell(
9191
rel: 'nofollow',
9292
title: 'Go to the documentation of $package ${version.version}',
9393
child: d.img(
94-
classes: ['version-table-icon', 'filter-invert-on-dark'],
94+
classes: ['pub-monochrome-icon', 'filter-invert-on-dark'],
9595
image: d.Image(
9696
src: staticUrls.documentationIcon,
9797
alt: 'Go to the documentation of $package ${version.version}',
@@ -106,7 +106,7 @@ d.Node _documentationCell(
106106
rel: 'nofollow',
107107
title: 'Check the analysis logs for $package ${version.version}',
108108
child: d.img(
109-
classes: ['version-table-icon', 'filter-invert-on-dark'],
109+
classes: ['pub-monochrome-icon', 'filter-invert-on-dark'],
110110
image: d.Image(
111111
src: staticUrls.documentationFailedIcon,
112112
alt: 'Check the analysis logs for $package ${version.version}',

app/test/frontend/golden/pkg_versions_page.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,12 @@ <h2 id="stable">Stable versions of oxygen</h2>
249249
</td>
250250
<td class="documentation">
251251
<a href="/documentation/oxygen/1.2.0/" rel="nofollow" title="Go to the documentation of oxygen 1.2.0">
252-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.2.0" width="24" height="24"/>
252+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.2.0" width="24" height="24"/>
253253
</a>
254254
</td>
255255
<td class="archive">
256256
<a href="/api/archives/oxygen-1.2.0.tar.gz" rel="nofollow" title="Download oxygen 1.2.0 archive">
257-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.2.0 archive" width="24" height="24"/>
257+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.2.0 archive" width="24" height="24"/>
258258
</a>
259259
</td>
260260
</tr>
@@ -271,12 +271,12 @@ <h2 id="stable">Stable versions of oxygen</h2>
271271
</td>
272272
<td class="documentation">
273273
<a href="/documentation/oxygen/1.0.0/" rel="nofollow" title="Go to the documentation of oxygen 1.0.0">
274-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.0.0" width="24" height="24"/>
274+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.0.0" width="24" height="24"/>
275275
</a>
276276
</td>
277277
<td class="archive">
278278
<a href="/api/archives/oxygen-1.0.0.tar.gz" rel="nofollow" title="Download oxygen 1.0.0 archive">
279-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.0.0 archive" width="24" height="24"/>
279+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.0.0 archive" width="24" height="24"/>
280280
</a>
281281
</td>
282282
</tr>
@@ -316,12 +316,12 @@ <h2 id="prerelease">Prerelease versions of oxygen</h2>
316316
</td>
317317
<td class="documentation">
318318
<a href="/documentation/oxygen/2.0.0-dev/" rel="nofollow" title="Go to the documentation of oxygen 2.0.0-dev">
319-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 2.0.0-dev" width="24" height="24"/>
319+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 2.0.0-dev" width="24" height="24"/>
320320
</a>
321321
</td>
322322
<td class="archive">
323323
<a href="/api/archives/oxygen-2.0.0-dev.tar.gz" rel="nofollow" title="Download oxygen 2.0.0-dev archive">
324-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 2.0.0-dev archive" width="24" height="24"/>
324+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 2.0.0-dev archive" width="24" height="24"/>
325325
</a>
326326
</td>
327327
</tr>

app/test/task/testdata/goldens/packages/oxygen/versions.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ <h2 id="stable">Stable versions of oxygen</h2>
235235
</td>
236236
<td class="documentation">
237237
<a href="/documentation/oxygen/2.0.0/" rel="nofollow" title="Go to the documentation of oxygen 2.0.0">
238-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 2.0.0" width="24" height="24"/>
238+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 2.0.0" width="24" height="24"/>
239239
</a>
240240
</td>
241241
<td class="archive">
242242
<a href="/api/archives/oxygen-2.0.0.tar.gz" rel="nofollow" title="Download oxygen 2.0.0 archive">
243-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 2.0.0 archive" width="24" height="24"/>
243+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 2.0.0 archive" width="24" height="24"/>
244244
</a>
245245
</td>
246246
</tr>
@@ -257,12 +257,12 @@ <h2 id="stable">Stable versions of oxygen</h2>
257257
</td>
258258
<td class="documentation">
259259
<a href="/documentation/oxygen/1.0.0/" rel="nofollow" title="Go to the documentation of oxygen 1.0.0">
260-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.0.0" width="24" height="24"/>
260+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/description-24px.svg" alt="Go to the documentation of oxygen 1.0.0" width="24" height="24"/>
261261
</a>
262262
</td>
263263
<td class="archive">
264264
<a href="/api/archives/oxygen-1.0.0.tar.gz" rel="nofollow" title="Download oxygen 1.0.0 archive">
265-
<img class="version-table-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.0.0 archive" width="24" height="24"/>
265+
<img class="pub-monochrome-icon filter-invert-on-dark" src="/static/hash-%%etag%%/img/vertical_align_bottom-24px.svg" alt="Download oxygen 1.0.0 archive" width="24" height="24"/>
266266
</a>
267267
</td>
268268
</tr>

pkg/web_css/lib/src/_base.scss

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ button {
8989
}
9090
}
9191

92+
// The class annotates an image icon with either black or white pixels on
93+
// a transparent base layer.
94+
// The default display with the muted opacity will move the icon's color
95+
// towards the gray spectrum, and on hovering it will show high contrast.
96+
//
97+
// Note: The `filter: brightness()` used below with the `a` element does
98+
// not work with monochrome images, as the linear transformation
99+
// will keep the pixels with rgb(0,0,0) the same.
100+
.pub-monochrome-icon {
101+
opacity: 0.6;
102+
103+
a:hover & {
104+
opacity: 1;
105+
}
106+
}
107+
92108
a {
93109
text-decoration: none;
94110
color: var(--pub-link-text-color);
@@ -103,10 +119,8 @@ a {
103119
}
104120

105121
.light-theme & {
106-
opacity: 1;
107-
108122
&:hover {
109-
opacity: 0.8;
123+
filter: brightness(80%);
110124
}
111125
}
112126

pkg/web_css/lib/src/_pkg.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@
115115
font-size: 24px;
116116
}
117117
}
118-
119-
.version-table-icon {
120-
opacity: 0.7;
121-
}
122118
}
123119

124120
.changelog-entry {

0 commit comments

Comments
 (0)