summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/image
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-06-12 05:35:40 -0500
committeradamdottv <[email protected]>2025-06-12 16:00:24 -0500
commitcce2e4ad754479917fc8f6f24c1421cf19c04573 (patch)
tree62c0ec32358932a468af73b44fd28e7de7859bbe /packages/tui/internal/image
parenta1ce35c208bf9ebca37f722e845035bd7fd5e801 (diff)
downloadopencode-cce2e4ad754479917fc8f6f24c1421cf19c04573.tar.gz
opencode-cce2e4ad754479917fc8f6f24c1421cf19c04573.zip
wip: refactoring tui
Diffstat (limited to 'packages/tui/internal/image')
-rw-r--r--packages/tui/internal/image/images.go17
1 files changed, 9 insertions, 8 deletions
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
}