---
title: "Ambient Card"
url: "https://sanyam.sh/lab/ambient-card"
date: "2026-10-04"
---

# Ambient Card

Drag the picture to turn it, or pick another below.

a picture that casts its shadow in its own colours. each side of the shadow is the colour most of that side of the picture is, so a picture that runs from cobalt to emerald throws blue off one corner and green off the other.

key insight: the edge is cut into thirty segments and each one takes a majority vote over a band of the picture just inside it, 64 coarse bins and the mean of the fullest, because the average of a band holding two colours is a third colour that is on neither. each colour is then pulled darker and more saturated, since a shadow on white has to be darker than the page to show at all.

the picture is a canvas sampled live, so dragging it round turns the shadow's colours with it, and a new picture's colours travel round the edge from the dot that was pressed.

- Source: https://github.com/SanyamPunia/www/blob/main/components/labs/ambient-card/glow.ts
