Files
xscapes/sheet.go
T
donlucasandClaude Fable 5 a646440725 Name decided: xscapes. Module path follows the repo URL
'create the repo on the donlucasx gh account, call it xscapes.' The
brief always said the name would be picked late, from the built thing;
this is that. asciiscapes and iixscapes are out.

The module path is not cosmetic here: Go resolves a module by its URL,
so a repo at donlucasx/xscapes whose go.mod says asciiscapes is broken
for anyone who tries to install it. Renamed across 37 files, which also
makes the built binary xscapes, which is what the README now types.

Deliberately NOT renamed: the ASCIISCAPES_* environment variables and
~/.config/asciiscapes/, because those are live state on this machine and
a rename would orphan an installed hook mid-session. The README says so
rather than leaving it to be discovered. The working directory and the
internal docs still say asciiscapes too; that is a migration, and he
asked for a repo.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PsdMUTHxbXJ8hud6jedByL
2026-09-01 08:29:10 -07:00

59 lines
2.0 KiB
Go

package main
import (
"fmt"
"strings"
"github.com/donlucasx/xscapes/internal/canvas"
"github.com/donlucasx/xscapes/internal/companion"
"github.com/donlucasx/xscapes/internal/scape"
"github.com/donlucasx/xscapes/internal/term"
)
var bubbleCol = term.RGB{R: 224, G: 228, B: 238}
// bubbleAskCol is the ask balloon: warm where the finish knock is cool, the
// same attention family as the worried eyes.
var bubbleAskCol = term.RGB{R: 244, G: 198, B: 122}
// contactSheet renders every candidate twice: enlarged so the drawing can be
// judged, and composited into a real 80x24 shore so the proportion is honest.
// A companion shown only enlarged always looks better than it is.
func contactSheet(seed int64) string {
var b strings.Builder
b.WriteString(`<h1>asciiscapes &mdash; references translated onto the canvas</h1>`)
for i := range companion.Candidates {
s := &companion.Candidates[i]
sw, sh := s.Size()
big := canvas.New(sw+2, sh+2, canvas.AlphaFar, canvas.AlphaMid, canvas.AlphaNear)
for y := 0; y < big.H; y++ {
for x := 0; x < big.W; x++ {
big.SetBG(x, y, term.RGB{R: 27, G: 27, B: 33})
}
}
s.Draw(big.Near(), 1, 1)
// Real target size, so the height cost is visible rather than argued.
live := canvas.New(80, 24, canvas.AlphaFar, canvas.AlphaMid, canvas.AlphaNear)
scape.NewShore(seed, false).Update(live, 2.0, scape.Activity{})
top := live.H - 2 - sh
s.Draw(live.Near(), 8, top)
if s.Say != "" {
rows := companion.Bubble(s.Say)
bub := companion.Sprite{Rows: rows, Body: bubbleCol, Opaque: true}
bub.Draw(live.Near(), 8+sw-2, top-len(rows))
}
fmt.Fprintf(&b,
`<div class="card"><div class="meta"><div class="nm">%s</div>`+
`<div class="rg">%d rows &middot; %s</div><div class="nt">%s</div></div>`+
`<div class="big"><div class="lbl">enlarged</div>%s</div>`+
`<div><div class="lbl">on an 80&times;24 shore, 1:1</div>%s</div></div>`,
s.Name, sh, s.Source, s.Note,
big.HTMLFragment(26), live.HTMLFragment(10))
}
return canvas.HTMLPage("asciiscapes — translated references", b.String())
}