I need a styling library for teashop,
ansi supports many of the operations that I want to support,
but not quite in the right way.
This issue is an open question of whether it makes sense to adapt/enhance ansi to support my styling needs.
For performance reasons, I would like to apply as many styles at once as possible, to avoid unnecessary string concatenations. Especially for Erlang. For teashop I might need to render multiple styles at 60 FPS.
For this, I would like to do something like a builder API:
pub fn bold(style, bool) { Style(..style, bold: bool) }
I would also like to support operations that don't feel like they fit into ansi, such as text alignment, padding, and borders.
Here is an incomplete list of all the things I want to be able to support:
pub type Style {
Style(
background: Option(Color),
blink: Bool,
bold: Bool,
faint: Bool,
foreground: Option(Color),
height: Option(Int),
italic: Bool,
margin_bottom: Int,
margin_left: Int,
margin_right: Int,
margin_top: Int,
max_height: Option(Int),
max_width: Option(Int),
padding_bottom: Int,
padding_left: Int,
padding_right: Int,
padding_top: Int,
reverse: Bool,
strikethrough: Bool,
underline: Bool,
width: Option(Int),
horizontal_alignment: Option(Alignment),
vertical_alignment: Option(Alignment),
underline_spaces: Bool,
strikethrough_spaces: Bool,
transform: Option(fn(String) -> String),
)
}
I will be using ANSI escape codes to achieve these colors and styles.
As much as possible, I would like to present a unified interface for building a style.
In Go, the styles are built up first, then concatenated in one operation:
https://github.com/muesli/termenv/blob/9850e567a4bfc1af41a28a48fbb1f6fde4e7f20a/style.go#L43-L57
Does it make sense to add such functionality to ansi?
Regardless of decision, I think it's important to note that ansi works right now with teashop, since teashop doesn't care where the ANSI strings come from.
I need a styling library for
teashop,ansisupports many of the operations that I want to support,but not quite in the right way.
This issue is an open question of whether it makes sense to adapt/enhance
ansito support my styling needs.For performance reasons, I would like to apply as many styles at once as possible, to avoid unnecessary string concatenations. Especially for Erlang. For
teashopI might need to render multiple styles at 60 FPS.For this, I would like to do something like a builder API:
I would also like to support operations that don't feel like they fit into
ansi, such as text alignment, padding, and borders.Here is an incomplete list of all the things I want to be able to support:
I will be using ANSI escape codes to achieve these colors and styles.
As much as possible, I would like to present a unified interface for building a style.
In Go, the styles are built up first, then concatenated in one operation:
https://github.com/muesli/termenv/blob/9850e567a4bfc1af41a28a48fbb1f6fde4e7f20a/style.go#L43-L57
Does it make sense to add such functionality to
ansi?Regardless of decision, I think it's important to note that
ansiworks right now withteashop, sinceteashopdoesn't care where the ANSI strings come from.