image

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package image provides an image bubble which can render images as strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(width int, img image.Image) string

ToString converts an image to a string representation of an image.

Types

type Model added in v0.3.1

type Model struct {
	Viewport    viewport.Model
	BorderColor lipgloss.AdaptiveColor
	Active      bool
	Borderless  bool
	FileName    string
	ImageString string
}

Model represents the properties of a code bubble.

func New

func New(active, borderless bool, borderColor lipgloss.AdaptiveColor) Model

New creates a new instance of code.

func (*Model) GotoTop added in v0.3.1

func (m *Model) GotoTop()

GotoTop jumps to the top of the viewport.

func (Model) Init added in v0.3.1

func (m Model) Init() tea.Cmd

Init initializes the code bubble.

func (*Model) SetBorderColor added in v0.3.1

func (m *Model) SetBorderColor(color lipgloss.AdaptiveColor)

SetBorderColor sets the current color of the border.

func (*Model) SetBorderless added in v0.3.1

func (m *Model) SetBorderless(borderless bool)

SetBorderless sets weather or not to show the border.

func (*Model) SetFileName added in v0.3.1

func (m *Model) SetFileName(filename string) tea.Cmd

SetFileName sets current file to highlight, this returns a cmd which will highlight the text.

func (*Model) SetIsActive added in v0.3.1

func (m *Model) SetIsActive(active bool)

SetIsActive sets if the bubble is currently active

func (*Model) SetSize added in v0.3.1

func (m *Model) SetSize(w, h int) tea.Cmd

SetSize sets the size of the bubble.

func (Model) Update added in v0.3.1

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles updating the UI of a code bubble.

func (Model) View added in v0.3.1

func (m Model) View() string

View returns a string representation of the code bubble.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL