import glink/internal import glink/style/color.{type Color} import glink/style/text_wrap.{type TextWrap} pub type Prop /// Change text color. Ink uses `chalk` under the hood, so all its functionality is supported. pub fn color(color: Color) -> Prop { internal.to_prop("color", color.value(color)) } /// Change text color. Ink uses `chalk` under the hood, so all its functionality is supported. pub fn color_(color: String) -> Prop { internal.to_prop("color", color) } /// Same as `color`, but for background. pub fn background_color(background_color: Color) -> Prop { internal.to_prop("backgroundColor", color.value(background_color)) } /// Same as `color`, but for background. pub fn background_color_(background_color: String) -> Prop { internal.to_prop("backgroundColor", background_color) } /// Dim the color (emit a small amount of light). pub fn dim_color(dim_color: Bool) -> Prop { internal.to_prop("dimColor", dim_color) } /// Dim the color (emit a small amount of light). pub fn dim_color_() -> Prop { dim_color(True) } /// Make the text bold. pub fn bold(bold: Bool) -> Prop { internal.to_prop("bold", bold) } /// Make the text bold. pub fn bold_() -> Prop { bold(True) } /// Make the text italic. pub fn italic(italic: Bool) -> Prop { internal.to_prop("italic", italic) } /// Make the text italic. pub fn italic_() -> Prop { italic(True) } /// Make the text underlined. pub fn underline(underline: Bool) -> Prop { internal.to_prop("underline", underline) } /// Make the text underlined. pub fn underline_() -> Prop { underline(True) } /// Make the text crossed with a line. pub fn strikethrough(strikethrough: Bool) -> Prop { internal.to_prop("strikethrough", strikethrough) } /// Make the text crossed with a line. pub fn strikethrough_() -> Prop { strikethrough(True) } /// Inverse background and foreground colors. pub fn inverse(inverse: Bool) -> Prop { internal.to_prop("inverse", inverse) } /// Inverse background and foreground colors. pub fn inverse_() -> Prop { inverse(True) } /// This property tells Ink to wrap or truncate text if its width is larger than container. /// If `Wrap` is passed (by default), Ink will wrap text and split it into multiple lines. /// If `Truncate*` is passed, Ink will truncate text instead, which will result in one line of text with the rest cut off. pub fn wrap(wrap: TextWrap) -> Prop { internal.to_prop("wrap", text_wrap.value(wrap)) }