Files
wehub-resource-sync ead81af521
CI / go (push) Waiting to run
CI / build (darwin, macos-14) (push) Waiting to run
CI / build (windows, windows-2025) (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 12:31:13 +08:00

31 lines
728 B
Go

package ui
import "strings"
// renderBars is the default smooth spectrum with fractional Unicode blocks.
func (v *Visualizer) renderBars(bands []float64) string {
height := v.Rows
lines := make([]string, height)
bandCount := len(bands)
for row := range height {
var content strings.Builder
rowBottom := float64(height-1-row) / float64(height)
rowTop := float64(height-row) / float64(height)
for i, level := range bands {
bw := visBandWidth(bandCount, i)
block := fracBlock(level, rowBottom, rowTop)
for range bw {
content.WriteString(block)
}
if i < bandCount-1 {
content.WriteByte(' ')
}
}
lines[row] = specWrap(rowBottom, content.String())
}
return strings.Join(lines, "\n")
}