vec/dict/vec_dict_ansi

Values

pub fn brailles(
  dict: dict.Dict(vec2.Vec2(Int), Int),
  start: vec2.Vec2(Int),
  stop: vec2.Vec2(Int),
) -> String

Converts vec-dict of 8-bit terminal colors to a brailles (⠃⠗⠁⠊⠇⠇⠑⠎) ANSI string.

Integers out of 0-255 range will be default color.

Examples

vec2i_dict.from_string(
  ""
  <> " ## ## \n"
  <> "#  #  #\n"
  <> "#     #\n"
  <> " #   # \n"
  <> "  # #  \n"
  <> "   #   \n",
)
|> dict.map_values(fn(_key, _value) { -1 })
|> brailles(vec2i.zero, Vec2(6, 5))
// ⢎⠑⢉⠆
// ⠀⠑⠁
pub fn brailles_hex(
  dict: dict.Dict(vec2.Vec2(Int), Int),
  start: vec2.Vec2(Int),
  stop: vec2.Vec2(Int),
) -> String

Converts vec-dict of hex code true colors to a brailles (⠃⠗⠁⠊⠇⠇⠑⠎) ANSI string.

Integers out of 0x000000-0xFFFFFF range will be default color.

Examples

vec2i_dict.from_string(
  ""
  <> " ## ## \n"
  <> "#  #  #\n"
  <> "#     #\n"
  <> " #   # \n"
  <> "  # #  \n"
  <> "   #   \n",
)
|> dict.map_values(fn(_key, _value) { -1 })
|> brailles(vec2i.zero, Vec2(6, 5))
// ⢎⠑⢉⠆
// ⠀⠑⠁
pub fn custom(
  dict: dict.Dict(vec2.Vec2(Int), String),
  start: vec2.Vec2(Int),
  stop: vec2.Vec2(Int),
) -> String

Converts vec-dict of string values to an ANSI string.

The string value can be any length, multi-lines, contain ANSI escape code. The function is also Unicodes aware.

Examples

vec2i_dict.from_string(
  ""
  <> " ## ## \n"
  <> "#  #  #\n"
  <> "#     #\n"
  <> " #   # \n"
  <> "  # #  \n"
  <> "   #   \n",
)
|> dict.map_values(fn(_key, _value) { "<3" })
|> custom(vec2i.zero, Vec2(6, 5))
//   <3<3  <3<3
// <3    <3    <3
// <3          <3
//   <3      <3
//     <3  <3
//       <3
pub fn half_blocks(
  dict: dict.Dict(vec2.Vec2(Int), Int),
  start: vec2.Vec2(Int),
  stop: vec2.Vec2(Int),
) -> String

Converts vec-dict of 8-bit terminal colors to a half blocks (█▀▄) ANSI string.

Integers out of 0-255 range will be default color.

Examples

vec2i_dict.from_string(
  ""
  <> " ## ## \n"
  <> "#  #  #\n"
  <> "#     #\n"
  <> " #   # \n"
  <> "  # #  \n"
  <> "   #   \n",
)
|> dict.map_values(fn(_key, _value) { -1 })
|> half_blocks(vec2i.zero, Vec2(6, 5))
// ▄▀▀▄▀▀▄
// ▀▄   ▄▀
//   ▀▄▀
pub fn half_blocks_hex(
  dict: dict.Dict(vec2.Vec2(Int), Int),
  start: vec2.Vec2(Int),
  stop: vec2.Vec2(Int),
) -> String

Converts vec-dict of hex code true colors to a half blocks (█▀▄) ANSI string.

Integers out of 0x000000-0xFFFFFF range will be default color.

Examples

vec2i_dict.from_string(
  ""
  <> " ## ## \n"
  <> "#  #  #\n"
  <> "#     #\n"
  <> " #   # \n"
  <> "  # #  \n"
  <> "   #   \n",
)
|> dict.map_values(fn(_key, _value) { -1 })
|> half_blocks(vec2i.zero, Vec2(6, 5))
// ▄▀▀▄▀▀▄
// ▀▄   ▄▀
//   ▀▄▀
Search Document