Files
sshtermy/internal/ui/gradient.go
T
db9979andClaude ec45c64266 Stand der Technik: Go 1.27, Update-Signatur mit Version, Herkunftsnachweis, alte SSH-Verfahren sichtbar, KI für Claude 5.5, MCP 2026-07-28 (#149)
- Go 1.27, Bibliotheken nachgezogen (x/crypto 0.59, lipgloss 2.1, ultraviolet, x/sys, ristretto255 0.2)
- PuTTY-Import ohne veraltete ECDSA-API; staticcheck sauber und als CI-Job lint
- checksums.txt nennt die Version und ist mit signiert (update.SumsVersion);
  release.yml in build/sign/publish getrennt, Schlüssel nur im Job sign
- Release mit Herkunftsnachweis (attest-build-provenance) und SBOM (CycloneDX);
  Codesignatur Windows/macOS vorbereitet (nur mit Secrets, docs/codesignatur.md)
- Alte SSH-Verfahren: gelber Hinweis beim Verbinden, Host-Übersicht zeigt SSH-Verfahren / quantensicher
- Vermittler und LAN-Teilen nur noch TLS 1.3
- KI: response_format json_object für Ziel/Agent/Plan, Prompt-Caching für Claude,
  Claude ab 4.7 ohne temperature, NoThink je Modell (thinking disabled bzw. effort low),
  Ablehnung (refusal) als Meldung, abgelehnte Felder je Endpunkt gemerkt
- Vorbelegung qwen3:8b / gpt-5-mini
- MCP 2026-07-28 (server/discover, _meta-Version, resultType), initialize für alte Clients


Claude-Session: https://claude.ai/code/session_018i4GUhLGo5pLYYKwLBkYN9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 21:03:22 +01:00

87 lines
2.4 KiB
Go

package ui
// Farbverläufe: Logo in der Kopfzeile von Akzent nach KI, Kopf- und
// Sitzungszeile mit einem sanften Schimmer der Umgebungsfarbe, der nach
// rechts in die normale Leiste übergeht. Aus bei Fensterstil „flach“ und im
// ruhigen Modus (gleiche Schalter wie die Schatten, frames.go).
import (
"image/color"
"strings"
"charm.land/lipgloss/v2"
"github.com/charmbracelet/x/ansi"
)
// gradientsOn: Verläufe zeichnen?
func gradientsOn() bool { return shadowsOn() }
// tintRun: Text mit dem Stil st, Hintergrund je Spalte aus bgAt (x zählt
// ab x0, damit mehrere Stücke einer Leiste einen Verlauf teilen). Gleiche
// Farben nebeneinander werden zusammengefasst.
func tintRun(s string, x0 int, st lipgloss.Style, bgAt func(x int) color.Color) string {
st = st.UnsetPadding()
// Hintergrund je Lauf als eigene Sequenz in einen einzigen Render: je Lauf
// ein eigenes Style.Render kostete in Kopf- und Sitzungszeile ~10 % eines Bildes.
var b strings.Builder
var runBg color.Color
runs, start := 0, true
for i, ch := range []rune(s) {
bg := bgAt(x0 + i)
if start || !sameColor(bg, runBg) {
runBg, start = bg, false
runs++
if bg == nil {
b.WriteString("\x1b[49m")
} else {
b.WriteString(ansi.Style{}.BackgroundColor(bg).String())
}
}
b.WriteRune(ch)
}
if runs <= 1 {
return st.Background(runBg).Render(s)
}
return st.Render(b.String())
}
// barTint: Hintergrund einer Leiste, links ein Hauch von tint, nach fade
// Spalten ganz base.
func barTint(tint, base color.Color, strength float64, fade int) func(x int) color.Color {
return func(x int) color.Color {
if tint == nil || !gradientsOn() {
return base
}
k := 1 - easeInOut(min(1, float64(x)/float64(max(1, fade))))
return mixColor(base, tint, strength*k)
}
}
func sameColor(a, b color.Color) bool {
if a == nil || b == nil {
return a == b
}
return rgbOf(a) == rgbOf(b)
}
func easeInOut(t float64) float64 {
if t < 0.5 {
return 2 * t * t
}
return 1 - (-2*t+2)*(-2*t+2)/2
}
// logoChip: „>_ sshTermy“ als Schild, Hintergrund von Akzent nach KI.
func (a *App) logoChip(text string) string {
t := a.s.T
if !gradientsOn() {
return a.s.Logo.Render(text)
}
text = " " + text + " "
n := len([]rune(text))
to := mixColor(t.Accent, t.AI, 0.85)
return tintRun(text, 0, a.s.Logo, func(x int) color.Color {
return mixColor(t.Accent, to, float64(x)/float64(max(1, n-1)))
})
}