From cce2e4ad754479917fc8f6f24c1421cf19c04573 Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Thu, 12 Jun 2025 05:35:40 -0500 Subject: wip: refactoring tui --- packages/tui/internal/image/images.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'packages/tui/internal/image') diff --git a/packages/tui/internal/image/images.go b/packages/tui/internal/image/images.go index f476b201c..742eb30a8 100644 --- a/packages/tui/internal/image/images.go +++ b/packages/tui/internal/image/images.go @@ -4,11 +4,12 @@ import ( "bytes" "fmt" "image" + "image/color" "image/png" "os" "strings" - "github.com/charmbracelet/lipgloss" + "github.com/charmbracelet/lipgloss/v2" "github.com/disintegration/imaging" "github.com/lucasb-eyer/go-colorful" _ "golang.org/x/image/webp" @@ -39,7 +40,7 @@ func ToString(width int, img image.Image) string { c1, _ := colorful.MakeColor(img.At(x, heightCounter)) color1 := lipgloss.Color(c1.Hex()) - var color2 lipgloss.Color + var color2 color.Color if heightCounter+1 < h { c2, _ := colorful.MakeColor(img.At(x, heightCounter+1)) color2 = lipgloss.Color(c2.Hex()) @@ -76,10 +77,10 @@ func ImagePreview(width int, filename string) (string, error) { func ImageToBytes(image image.Image) ([]byte, error) { buf := new(bytes.Buffer) - err := png.Encode(buf, image) - if err != nil { - return nil, err - } - - return buf.Bytes(), nil + err := png.Encode(buf, image) + if err != nil { + return nil, err + } + + return buf.Bytes(), nil } -- cgit v1.2.3