oficina / base Public

Draw Base's tiles the size and shape of the Oficina icons

Estilo's Oficina artwork draws its squircle (with its edge) from 3.5%
to 96.5% of the icon, corners about 22% round, so it showed about 60px
in Home's 64px boxes (56px in the phone's 60px) while Base's own tiles
filled the box and looked bigger. They now draw the same squircle in
the same box, and their glyphs are about half its width with a 2.2px
stroke, so they read as one family. To keep the white glyphs at 3:1
the light rose tint and the dark amber tint are a little deeper.

TestTilesMatchOficinaIcons measures every icon from the screen (one
shot with the icons, one without) and holds each tile to Calendar's
squircle within a pixel on a wide screen and a phone; TestHomeApps now
checks the tiles' icon contrast in dark as well as light.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 858f146bde0156f135d60068b8d0a203f89c22dc parent 3c5247c
2 files changed, +160 −12
  • internal/browsertest/layout_test.go +140 −0
  • internal/look/static/app.css +20 −12
diff --git a/internal/browsertest/layout_test.go b/internal/browsertest/layout_test.go
index b6e1f2d..51722bb 100644
--- a/internal/browsertest/layout_test.go
+++ b/internal/browsertest/layout_test.go
@@ -3,10 +3,15 @@
package browsertest
import (
+ "bytes"
"context"
"encoding/json"
"fmt"
+ "image"
+ "image/png"
+ "math"
"os"
+ "path/filepath"
"testing"
"time"
@@ -175,6 +180,9 @@ func TestHomeApps(t *testing.T) {
}
if w == 1280 {
checkContrast(t, rig, "Home, "+scheme, ".lede", ".app-grid .label", "a.me")
+ for _, tint := range []string{"teal", "violet", "mist", "amber", "rose"} {
+ iconContrast(t, rig, "Home, "+scheme, "nav.apps .tile.t-"+tint+" svg")
+ }
if got := harness.Evaluate[string](rig, `(() => { const r = document.querySelector("a.me").getBoundingClientRect(), bar = document.querySelector(".topbar").getBoundingClientRect();
return r.width >= 44 && r.height >= 44 && r.top >= bar.top - 0.5 && r.bottom <= bar.bottom + 0.5 ? "" : r.width + "x" + r.height + " at " + r.top + "-" + r.bottom; })()`); got != "" {
t.Errorf("%s: the avatar (Settings) target is %s, want 44px inside the top bar", scheme, got)
@@ -267,3 +275,135 @@ func TestAskPopover(t *testing.T) {
}
drive(t, rig, reducedMotion("dark", false))
}
+
+// drawnIcon is what one app icon paints, measured in pixels, relative to
+// its 64px (or 60px) box.
+type drawnIcon struct {
+ Name string
+ Image bool // an Oficina icon (Estilo's artwork) rather than one of Base's tiles
+ L, T, W, H float64
+}
+
+// drawnIcons measures every icon in Home's grid from the screen: with the
+// page paused, one screenshot with the icons and one without; the pixels
+// that differ are each icon's drawing.
+func drawnIcons(t *testing.T, rig *harness.Rig) []drawnIcon {
+ t.Helper()
+ drive(t, rig, chromedp.Evaluate[chromedp.Void](pauseJS), chromedp.Sleep(150*time.Millisecond))
+ with := harness.Read(rig, chromedp.CaptureScreenshot())
+ var icons []struct {
+ Name string
+ Image bool
+ X, Y, W, H float64
+ }
+ if err := json.Unmarshal([]byte(harness.Evaluate[string](rig, `JSON.stringify([...document.querySelectorAll(".app-grid .icon")].map(i => {
+ const r = i.getBoundingClientRect(); i.style.visibility = "hidden";
+ return {Name: i.closest("a").textContent.trim(), Image: !!i.querySelector("img"), X: r.left, Y: r.top, W: r.width, H: r.height};
+ }))`)), &icons); err != nil {
+ t.Fatal(err)
+ }
+ without := harness.Read(rig, chromedp.CaptureScreenshot())
+ dpr := harness.Evaluate[float64](rig, `window.devicePixelRatio`)
+ drive(t, rig, chromedp.Evaluate[chromedp.Void](`document.querySelectorAll(".app-grid .icon").forEach(i => i.style.removeProperty("visibility")), `+unpauseJS))
+ a, err := png.Decode(bytes.NewReader(with))
+ if err != nil {
+ t.Fatal(err)
+ }
+ b, err := png.Decode(bytes.NewReader(without))
+ if err != nil {
+ t.Fatal(err)
+ }
+ var out []drawnIcon
+ for _, ic := range icons {
+ x0, y0 := int((ic.X-3)*dpr), int((ic.Y-3)*dpr)
+ x1, y1 := int((ic.X+ic.W+3)*dpr), int((ic.Y+ic.H+3)*dpr)
+ minX, minY, maxX, maxY := x1, y1, x0, y0
+ for y := max(0, y0); y < y1; y++ {
+ for x := max(0, x0); x < x1; x++ {
+ ar, ag, ab, _ := a.At(x, y).RGBA()
+ br, bg, bb, _ := b.At(x, y).RGBA()
+ if diff(ar, br)+diff(ag, bg)+diff(ab, bb) < 30 {
+ continue
+ }
+ minX, minY, maxX, maxY = min(minX, x), min(minY, y), max(maxX, x), max(maxY, y)
+ }
+ }
+ out = append(out, drawnIcon{Name: ic.Name, Image: ic.Image,
+ L: float64(minX)/dpr - ic.X, T: float64(minY)/dpr - ic.Y,
+ W: float64(maxX-minX+1) / dpr, H: float64(maxY-minY+1) / dpr})
+ }
+ return out
+}
+
+// Base's own tiles (Store, People, Settings and the installed apps) are
+// drawn the size and shape of Estilo's Oficina icons, whose squircle sits
+// inside the box with a margin: on screen each matches within a pixel, on
+// a wide screen and a phone.
+func TestTilesMatchOficinaIcons(t *testing.T) {
+ apps := teamApps(t)
+ rig, _, b := askBaseWith(t, func(c *config.Config) { c.OficinaApps = apps })
+ installAll(t, b)
+ for _, c := range []struct {
+ name string
+ size chromedp.Action[chromedp.Void]
+ }{
+ {"wide", chromedp.EmulateViewport(1280, 800, chromedp.EmulateScale(2))},
+ {"phone", chromedp.EmulateViewport(390, 844, chromedp.EmulateMobile, chromedp.EmulateScale(3))},
+ } {
+ drive(t, rig, reducedMotion("dark", true), c.size, chromedp.Navigate(rig.Origin+"/"), chromedp.WaitVisible(chromedp.CSS("nav.apps")),
+ chromedp.Poll[chromedp.Void](`[...document.images].every(i => i.complete)`, chromedp.WithPollingTimeout(5*time.Second)))
+ icons := drawnIcons(t, rig)
+ var ref *drawnIcon
+ for i := range icons {
+ if icons[i].Image && icons[i].Name == "Calendar" {
+ ref = &icons[i]
+ }
+ }
+ if ref == nil {
+ t.Fatalf("%s: no Calendar icon", c.name)
+ }
+ t.Logf("%s: Calendar's squircle %+v", c.name, *ref)
+ for _, ic := range icons {
+ if math.Abs(ic.L-ref.L) > 1 || math.Abs(ic.T-ref.T) > 1 || math.Abs(ic.W-ref.W) > 1 || math.Abs(ic.H-ref.H) > 1 {
+ t.Errorf("%s: %s is drawn at %.1f,%.1f %.1fx%.1f; Calendar at %.1f,%.1f %.1fx%.1f", c.name, ic.Name, ic.L, ic.T, ic.W, ic.H, ref.L, ref.T, ref.W, ref.H)
+ }
+ }
+ if c.name == "wide" {
+ saveTilesZoom(t, rig)
+ }
+ }
+ drive(t, rig, reducedMotion("dark", false))
+}
+
+// saveTilesZoom saves the rows where Oficina icons and Base's tiles meet,
+// at twice size, to BASE_LAYOUT_ARTIFACTS/tiles-zoom.png.
+func saveTilesZoom(t *testing.T, rig *harness.Rig) {
+ t.Helper()
+ dir := os.Getenv("BASE_LAYOUT_ARTIFACTS")
+ if dir == "" {
+ return
+ }
+ var r struct{ X, Y, W, H float64 }
+ if err := json.Unmarshal([]byte(harness.Evaluate[string](rig, `(() => {
+ const items = [...document.querySelectorAll(".app-grid > li")], a = items[5].getBoundingClientRect(), z = items[items.length - 1].getBoundingClientRect();
+ const p = document.querySelector("nav.apps").getBoundingClientRect();
+ return JSON.stringify({X: p.left, Y: a.top - 8, W: p.width, H: z.bottom - a.top + 16});
+ })()`)), &r); err != nil {
+ t.Fatal(err)
+ }
+ img, err := png.Decode(bytes.NewReader(harness.Read(rig, chromedp.CaptureScreenshot())))
+ if err != nil {
+ t.Fatal(err)
+ }
+ dpr := harness.Evaluate[float64](rig, `window.devicePixelRatio`)
+ crop := img.(interface {
+ SubImage(image.Rectangle) image.Image
+ }).SubImage(image.Rect(int(r.X*dpr), int(r.Y*dpr), int((r.X+r.W)*dpr), int((r.Y+r.H)*dpr)))
+ var buf bytes.Buffer
+ if err := png.Encode(&buf, crop); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(dir, "tiles-zoom.png"), buf.Bytes(), 0o644); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/internal/look/static/app.css b/internal/look/static/app.css
index e46f461..e3878da 100644
--- a/internal/look/static/app.css
+++ b/internal/look/static/app.css
@@ -85,7 +85,7 @@
--alarm-edge: rgba(243,198,201,.35);
/* Tiles: a little deeper in the light, so their white icons read. */
--tile-ink: #EEF2F8;
- --amber-1: rgba(255,176,102,.78);
+ --amber-1: rgba(226,128,56,.82);
--amber-2: rgba(244,114,182,.22);
--teal-1: rgba(47,198,192,.55);
--teal-2: rgba(47,198,192,.12);
@@ -135,7 +135,7 @@
--amber-1: rgba(192,96,24,.95); --amber-2: rgba(200,70,130,.8); --teal-1: rgba(12,136,129,.95);
--teal-2: rgba(16,150,143,.85); --violet-1: rgba(110,62,220,.9); --violet-2: rgba(124,77,232,.72);
--mist-1: rgba(84,96,138,.88); --mist-2: rgba(100,112,152,.7); --rose-1: rgba(205,58,128,.92);
- --rose-2: rgba(222,82,150,.72); --menu-1: rgba(255,255,255,0); --menu-2: rgba(255,255,255,0);
+ --rose-2: rgba(208,62,132,.82); --menu-1: rgba(255,255,255,0); --menu-2: rgba(255,255,255,0);
--menu-base: #FBFBFE; --menu-shine: rgba(255,255,255,.95); --menu-shadow: rgba(40,46,90,.3);
--sheet-1: rgba(255,255,255,.82); --sheet-2: rgba(255,255,255,.72); --sheet-base: rgba(244,245,252,.6);
--scrim: rgba(30,36,64,.18); --mine: rgba(15,168,156,.14); --mine-edge: rgba(15,168,156,.38);
@@ -194,7 +194,7 @@
--alarm: light-dark(rgba(243,198,201,.35), rgba(243,198,201,.12));
--alarm-edge: light-dark(rgba(200,90,100,.35), rgba(243,198,201,.35));
--tile-ink: light-dark(#FFFFFF, #EEF2F8);
- --amber-1: light-dark(rgba(192,96,24,.95), rgba(255,176,102,.78));
+ --amber-1: light-dark(rgba(192,96,24,.95), rgba(226,128,56,.82));
--amber-2: light-dark(rgba(200,70,130,.8), rgba(244,114,182,.22));
--teal-1: light-dark(rgba(12,136,129,.95), rgba(47,198,192,.55));
--teal-2: light-dark(rgba(16,150,143,.85), rgba(47,198,192,.12));
@@ -203,7 +203,7 @@
--mist-1: light-dark(rgba(84,96,138,.88), rgba(201,211,227,.4));
--mist-2: light-dark(rgba(100,112,152,.7), rgba(201,211,227,.08));
--rose-1: light-dark(rgba(205,58,128,.92), rgba(244,114,182,.55));
- --rose-2: light-dark(rgba(222,82,150,.72), rgba(244,114,182,.12));
+ --rose-2: light-dark(rgba(208,62,132,.82), rgba(244,114,182,.12));
--menu-1: light-dark(rgba(255,255,255,0), rgba(238,242,248,.08));
--menu-2: light-dark(rgba(255,255,255,0), rgba(238,242,248,.04));
--menu-base: light-dark(#FBFBFE, rgb(24,28,62));
@@ -331,15 +331,25 @@ button.alt[aria-busy="true"] { cursor: progress; }
a.app:hover { background: var(--hover); }
.app .icon { flex: none; width: 64px; height: 64px; display: grid; place-items: center; }
.app .icon img { width: 100%; height: 100%; display: block; }
-.app .tile { border-radius: 16px; border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-shine); }
+/* Base's own tiles are drawn like Estilo's Oficina icons, whose squircle
+ (with its edge) spans 3.5% to 96.5% of the artwork, corners about 22%
+ round: the same squircle inside the same box, and a white glyph drawn
+ about half the squircle's width (its art fills about three quarters of
+ its 24-unit box) with a 2.2px stroke, as heavy as the Oficina glyphs read. */
+.app .icon.tile { position: relative; background: none; border-radius: 0; }
+.app .icon.tile::before { content: ""; position: absolute; inset: 3.5%; border-radius: 22%; background: var(--tint);
+ border: 1px solid var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-shine); }
+.app .icon.tile svg { position: relative; width: 68%; height: 68%; }
+.app .icon.tile svg * { stroke-width: 2.2px; vector-effect: non-scaling-stroke; }
.app .label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile { width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; }
.tile svg { width: 28px; height: 28px; stroke: var(--tile-ink); fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
-.tile.t-amber { background: linear-gradient(155deg, var(--amber-1), var(--amber-2)); }
-.tile.t-teal { background: linear-gradient(155deg, var(--teal-1), var(--teal-2)); }
-.tile.t-violet { background: linear-gradient(155deg, var(--violet-1), var(--violet-2)); }
-.tile.t-mist { background: linear-gradient(155deg, var(--mist-1), var(--mist-2)); }
-.tile.t-rose { background: linear-gradient(155deg, var(--rose-1), var(--rose-2)); }
+.tile { background: var(--tint); }
+.tile.t-amber { --tint: linear-gradient(155deg, var(--amber-1), var(--amber-2)); }
+.tile.t-teal { --tint: linear-gradient(155deg, var(--teal-1), var(--teal-2)); }
+.tile.t-violet { --tint: linear-gradient(155deg, var(--violet-1), var(--violet-2)); }
+.tile.t-mist { --tint: linear-gradient(155deg, var(--mist-1), var(--mist-2)); }
+.tile.t-rose { --tint: linear-gradient(155deg, var(--rose-1), var(--rose-2)); }
.app.new { animation: condense 1.2s cubic-bezier(.2,.7,0,1) both; }
@keyframes condense { from { opacity: 0; filter: blur(14px); transform: scale(.94); } to { opacity: 1; filter: none; transform: none; } }
.app.leaving { animation: dissolve .5s ease forwards; }
@@ -509,8 +519,6 @@ main { min-height: 100dvh; }
.app-grid { grid-template-columns: repeat(4, 1fr); max-width: none; gap: 16px 0; }
.app { width: 100%; max-width: 86px; padding: 4px 2px 2px; gap: 6px; font-size: 12px; }
.app .icon { width: 60px; height: 60px; }
- .app .tile { border-radius: 15px; }
- .app .tile svg { width: 26px; height: 26px; }
/* Opening the chat, Home steps back behind the sheet. */
main.home { transform-origin: 50% 30%; transition: transform .4s cubic-bezier(.2,.8,.2,1), filter .4s; }
body:has(dialog.ask-panel[open]) main.home { transform: scale(.94); filter: blur(3px) brightness(.8); }