/* Package fbdraw provides a simple, immediate-mode API for rendering monospaced text to Linux framebuffers. # Basic Usage The simplest way to create a display: display, err := fbdraw.Init() if err != nil { log.Fatal(err) } defer display.Close() display.Loop(func(d *fbdraw.Draw) { d.Clear() d.Font(fbdraw.PlexMono).Size(24).Bold() d.Color(fbdraw.White) d.TextCenter(d.Width/2, 50, "Hello, Framebuffer!") d.Present() }) # Working with Grids For structured layouts, use the grid system: grid := d.Grid(10, 10, 80, 25) // x, y, columns, rows grid.Border(fbdraw.White) grid.Color(fbdraw.Green).Bold() grid.WriteCenter(0, "System Status") grid.Plain().Color(fbdraw.White) grid.Write(2, 0, "CPU:") grid.Bar(2, 10, 30, cpuPercent, fbdraw.Heat(cpuPercent)) # Drawing State The Draw object maintains state between calls: d.Font(fbdraw.PlexMono).Size(14).Bold() d.Color(fbdraw.Green) d.Text(10, 10, "This is green bold text") d.Text(10, 30, "This is still green bold text") d.Plain().Color(fbdraw.White) d.Text(10, 50, "This is white plain text") # Performance The package is designed for status displays that update at most a few times per second. It prioritizes ease of use over performance. Each Present() call updates the entire framebuffer. # Fonts Three monospace fonts are bundled: - PlexMono: IBM Plex Mono, excellent readability - Terminus: Classic bitmap terminal font - SourceCodePro: Adobe's coding font # Colors Common colors are provided as package variables (Black, White, Red, etc). Grays are available from Gray10 (darkest) to Gray90 (lightest). # Error Handling Most operations fail silently to keep the API simple. Use explicit error checks where needed: if err := d.Present(); err != nil { // Handle framebuffer write error } */ package fbdraw