Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Mirror of Tasker project `4rays-net`. One focused PR. Validate with `pnpm check`, `pnpm format:check`, and `pnpm build`, and check the page in a browser in light and dark.

- [ ] Tint the project circle icons orange at rest (Tasker #543) (Goal 6a952708a8fb)
- [x] Tint the project circle icons orange at rest (Tasker #543) (Goal 6a952708a8fb)
Criteria C1 and C2. Verified against 3e3a1e9.
Gap: src/components/CircleLink.astro sets `.disc :global(img) { filter: grayscale(1) contrast(1.05); }`, so the Circle and Combolab images are grayscale at rest and reveal full colour on hover/focus. The non-interactive TBA circle shows the mark 極秘 in `.monogram` (src/pages/[...lang]/index.astro) in var(--muted-foreground), which is gray.
Scope:
Expand Down
42 changes: 34 additions & 8 deletions src/components/CircleLink.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
/**
* A circular link. The disc content comes from the default slot.
* Hover / focus: the ring traces itself in and the image comes to full colour.
* Image discs carry an orange monochrome tint at rest; hover / focus traces
* the ring in and crossfades a colour copy of the image over the tint.
*/
interface Props {
/** Leave out to render a non-interactive circle (for example, an unreleased project). */
Expand Down Expand Up @@ -73,6 +74,8 @@ const Tag = href ? "a" : "div";
box-shadow:
inset 0 0 0 1px var(--border),
0 10px 30px -12px rgb(0 0 0 / 0.45);
/* Keep the tint overlay's blend mode inside the disc. */
isolation: isolate;
transition:
box-shadow 0.5s var(--ease),
background-color 0.4s var(--ease);
Expand All @@ -82,10 +85,31 @@ const Tag = href ? "a" : "div";
width: 100%;
height: 100%;
object-fit: cover;
filter: grayscale(1) contrast(1.05);
transform: scale(1.001);
}

/* Orange monochrome tint at rest: the accent hue over the image's own
luminance, so the artwork stays recognizable. The blend layer and the
image under it never animate; WebKit's blend compositing stays stable
that way, and the reveal happens on a colour copy above the tint. */
.disc:has(:global(img))::after {
content: "";
position: absolute;
inset: 0;
background: var(--accent);
mix-blend-mode: color;
pointer-events: none;
}

/* The colour copy fades straight in over the static tint, so WebKit
never recomposites the blend group during the transition. */
.disc :global(img.reveal) {
position: absolute;
inset: 0;
z-index: 1;
opacity: 0;
transition:
filter 0.5s var(--ease),
opacity 0.5s var(--ease),
transform 0.7s var(--ease);
}

Expand Down Expand Up @@ -145,8 +169,8 @@ const Tag = href ? "a" : "div";
0 18px 40px -14px color-mix(in oklab, var(--accent) 45%, transparent);
}

.circle:is(:hover, :focus-visible) .disc :global(img) {
filter: none;
.circle:is(:hover, :focus-visible) .disc :global(img.reveal) {
opacity: 1;
transform: scale(1.08);
}

Expand Down Expand Up @@ -187,11 +211,13 @@ const Tag = href ? "a" : "div";
transition-delay: 0s !important;
}

.disc :global(img) {
transition: filter 0.3s linear;
.disc :global(img.reveal) {
transition:
opacity 0.3s linear,
transform 0.01s linear;
}

.circle:is(:hover, :focus-visible) .disc :global(img) {
.circle:is(:hover, :focus-visible) .disc :global(img.reveal) {
transform: none;
}
}
Expand Down
27 changes: 19 additions & 8 deletions src/pages/[...lang]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,24 @@ const monogram = (name: string) =>
tagline={t.home.projects[project.id].tagline}
>
{project.image ? (
<img
src={project.image}
alt=""
width="256"
height="256"
loading="lazy"
/>
<>
<img
src={project.image}
alt=""
width="256"
height="256"
loading="lazy"
/>
<img
src={project.image}
alt=""
aria-hidden="true"
class="reveal"
width="256"
height="256"
loading="lazy"
/>
</>
) : (
<span class="monogram" lang={project.markLang}>
{project.mark ?? monogram(project.name)}
Expand Down Expand Up @@ -215,7 +226,7 @@ const monogram = (name: string) =>
font-size: 1.6rem;
font-weight: 300;
letter-spacing: 0.08em;
color: var(--muted-foreground);
color: var(--accent);
}

.monogram:lang(ja) {
Expand Down