BB.TUI.Theme (BB.TUI v0.1.0)

Copy Markdown View Source

Color, style, and rich-text constants for the BB TUI dashboard.

Provides a consistent visual palette for the robot dashboard. All functions are pure and return a color atom, an %ExRatatui.Style{}, an %ExRatatui.Text.Span{}, or an %ExRatatui.Text.Line{} โ€” never a side effect.

Rich text

Summary

Functions

Bold green style for armed state.

Style for blocked commands โ€” dark gray.

Blue for interactive elements and paths.

Returns focused or unfocused border style based on boolean.

Branded title-bar line โ€” ๐Ÿค– BB.TUI ยท MyApp.Robot[ @ node].

Cyan for timestamps and active panel borders.

Muted border color for inactive panels.

Dim span used between key pills.

Muted text for secondary information.

Dim style for disarmed state.

Bold yellow style for disarming state.

Bold red style for error state.

Cyan border style for the active/focused panel.

Builds a %Line{} of key_pill/2 + dim_span/1 pairs from a list of {label, description} entries. Pass a {label, description, :quit} triple for the warning-red pill.

Style for the gauge filled portion โ€” green.

Style for the gauge unfilled portion โ€” dark gray.

Green for armed/safe states.

Highlight style for selected items.

Colored "key" pill โ€” keys render bold over a colored background, used in the status bar and help hints.

Magenta for parameter values and accents.

Returns the solid-pill badge spans for a panel title. The number renders bold-black over a cyan background, mirroring the footer keybind pills so the global 1..5 shortcuts are unmistakable in the panel header. Returns an empty list when n is nil, so callers can safely splat the result even for panels that aren't on the cycle ring.

Bold style for panel title text, so the panel name stands shoulder to shoulder with the solid number pill rendered by panel_badge_spans/1.

Style for event path labels โ€” blue.

Foreground color for a joint position bar based on its limit proximity (the value returned by BB.TUI.State.limit_proximity/2).

Bold style for ready commands โ€” green.

Red for error states.

Color-coded safety badge โ€” a single %Span{} pill that reads the current safety state at a glance.

Style for simulated joint indicators โ€” yellow.

Deep Elixir/BB violet used as the title bar background.

Light lavender foreground used on top of the title bar background.

Dim border style for inactive panels.

Yellow for transitional states (disarming).

Functions

armed_style()

@spec armed_style() :: ExRatatui.Style.t()

Bold green style for armed state.

Examples

iex> style = BB.TUI.Theme.armed_style()
iex> style.fg
:green
iex> style.modifiers
[:bold]

blocked_style()

@spec blocked_style() :: ExRatatui.Style.t()

Style for blocked commands โ€” dark gray.

Examples

iex> BB.TUI.Theme.blocked_style().fg
:dark_gray

blue()

@spec blue() :: ExRatatui.Style.color()

Blue for interactive elements and paths.

Examples

iex> BB.TUI.Theme.blue()
:blue

border_style(bool)

@spec border_style(boolean()) :: ExRatatui.Style.t()

Returns focused or unfocused border style based on boolean.

Examples

iex> BB.TUI.Theme.border_style(true) == BB.TUI.Theme.focused_border_style()
true

iex> BB.TUI.Theme.border_style(false) == BB.TUI.Theme.unfocused_border_style()
true

brand_title(robot, node)

@spec brand_title(module(), node() | nil) :: ExRatatui.Text.Line.t()

Branded title-bar line โ€” ๐Ÿค– BB.TUI ยท MyApp.Robot[ @ node].

BB.TUI renders bold over title_fg/0; the robot module renders bold cyan; the optional @ node segment trails in dim text.

Examples

iex> %ExRatatui.Text.Line{spans: spans} =
...>   BB.TUI.Theme.brand_title(MyApp.Robot, nil)
iex> Enum.map(spans, & &1.content)
[" ๐Ÿค– ", "BB.TUI", " ยท ", "MyApp.Robot"]

iex> %ExRatatui.Text.Line{spans: spans} =
...>   BB.TUI.Theme.brand_title(MyApp.Robot, :"robot@host")
iex> Enum.map_join(spans, "", & &1.content)
" ๐Ÿค– BB.TUI ยท MyApp.Robot @ robot@host"

cyan()

@spec cyan() :: ExRatatui.Style.color()

Cyan for timestamps and active panel borders.

Examples

iex> BB.TUI.Theme.cyan()
:cyan

dim_border()

@spec dim_border() :: ExRatatui.Style.color()

Muted border color for inactive panels.

Examples

iex> BB.TUI.Theme.dim_border()
:dark_gray

dim_span(text)

@spec dim_span(String.t()) :: ExRatatui.Text.Span.t()

Dim span used between key pills.

Examples

iex> span = BB.TUI.Theme.dim_span(" panels")
iex> span.content
" panels"
iex> span.style.fg == BB.TUI.Theme.dim_text()
true

dim_text()

@spec dim_text() :: ExRatatui.Style.color()

Muted text for secondary information.

Examples

iex> BB.TUI.Theme.dim_text()
:dark_gray

disarmed_style()

@spec disarmed_style() :: ExRatatui.Style.t()

Dim style for disarmed state.

Examples

iex> style = BB.TUI.Theme.disarmed_style()
iex> style.fg
:dark_gray

disarming_style()

@spec disarming_style() :: ExRatatui.Style.t()

Bold yellow style for disarming state.

Examples

iex> style = BB.TUI.Theme.disarming_style()
iex> style.fg
:yellow
iex> style.modifiers
[:bold]

error_style()

@spec error_style() :: ExRatatui.Style.t()

Bold red style for error state.

Examples

iex> style = BB.TUI.Theme.error_style()
iex> style.fg
:red
iex> style.modifiers
[:bold]

focused_border_style()

@spec focused_border_style() :: ExRatatui.Style.t()

Cyan border style for the active/focused panel.

Examples

iex> BB.TUI.Theme.focused_border_style().fg
:cyan

gauge_filled_style()

@spec gauge_filled_style() :: ExRatatui.Style.t()

Style for the gauge filled portion โ€” green.

Examples

iex> BB.TUI.Theme.gauge_filled_style().fg
:green

gauge_unfilled_style()

@spec gauge_unfilled_style() :: ExRatatui.Style.t()

Style for the gauge unfilled portion โ€” dark gray.

Examples

iex> BB.TUI.Theme.gauge_unfilled_style().fg
:dark_gray

green()

@spec green() :: ExRatatui.Style.color()

Green for armed/safe states.

Examples

iex> BB.TUI.Theme.green()
:green

highlight_style()

@spec highlight_style() :: ExRatatui.Style.t()

Highlight style for selected items.

Examples

iex> style = BB.TUI.Theme.highlight_style()
iex> style.fg
:cyan
iex> style.modifiers
[:bold]

key_pill(label, kind \\ :default)

@spec key_pill(String.t(), :default | :quit) :: ExRatatui.Text.Span.t()

Colored "key" pill โ€” keys render bold over a colored background, used in the status bar and help hints.

Pass :quit for the warning red pill (used for q); any other atom uses the calm cyan pill.

Examples

iex> pill = BB.TUI.Theme.key_pill("Tab")
iex> pill.content
" Tab "
iex> pill.style.bg
:cyan

iex> pill = BB.TUI.Theme.key_pill("q", :quit)
iex> pill.style.bg
:red
iex> :bold in pill.style.modifiers
true

magenta()

@spec magenta() :: ExRatatui.Style.color()

Magenta for parameter values and accents.

Examples

iex> BB.TUI.Theme.magenta()
:magenta

panel_badge_spans(n)

@spec panel_badge_spans(pos_integer() | nil) :: [ExRatatui.Text.Span.t()]

Returns the solid-pill badge spans for a panel title. The number renders bold-black over a cyan background, mirroring the footer keybind pills so the global 1..5 shortcuts are unmistakable in the panel header. Returns an empty list when n is nil, so callers can safely splat the result even for panels that aren't on the cycle ring.

Examples

iex> [%ExRatatui.Text.Span{content: " "}, %ExRatatui.Text.Span{content: " 3 ", style: style}, %ExRatatui.Text.Span{content: " "}] =
...>   BB.TUI.Theme.panel_badge_spans(3)
iex> style.bg
:cyan
iex> style.fg
:black
iex> :bold in style.modifiers
true

iex> BB.TUI.Theme.panel_badge_spans(nil)
[]

panel_title_style()

@spec panel_title_style() :: ExRatatui.Style.t()

Bold style for panel title text, so the panel name stands shoulder to shoulder with the solid number pill rendered by panel_badge_spans/1.

Examples

iex> BB.TUI.Theme.panel_title_style().modifiers
[:bold]

path_style()

@spec path_style() :: ExRatatui.Style.t()

Style for event path labels โ€” blue.

Examples

iex> BB.TUI.Theme.path_style().fg
:blue

proximity_color(arg1)

@spec proximity_color(atom()) :: ExRatatui.Style.color()

Foreground color for a joint position bar based on its limit proximity (the value returned by BB.TUI.State.limit_proximity/2).

proximitycolor
:normalgreen
:warningyellow
:dangerred

Examples

iex> BB.TUI.Theme.proximity_color(:normal)
:green
iex> BB.TUI.Theme.proximity_color(:warning)
:yellow
iex> BB.TUI.Theme.proximity_color(:danger)
:red

ready_style()

@spec ready_style() :: ExRatatui.Style.t()

Bold style for ready commands โ€” green.

Examples

iex> BB.TUI.Theme.ready_style().fg
:green

red()

@spec red() :: ExRatatui.Style.color()

Red for error states.

Examples

iex> BB.TUI.Theme.red()
:red

safety_badge(other)

@spec safety_badge(atom()) :: ExRatatui.Text.Span.t()

Color-coded safety badge โ€” a single %Span{} pill that reads the current safety state at a glance.

statebgfg
:armedgreenblack
:disarmednonedim
:disarmingyellowblack
:errorredwhite

Examples

iex> badge = BB.TUI.Theme.safety_badge(:armed)
iex> badge.content
" โ— ARMED "
iex> badge.style.bg
:green

iex> badge = BB.TUI.Theme.safety_badge(:error)
iex> badge.content
" โœ– ERROR "
iex> badge.style.bg
:red

iex> BB.TUI.Theme.safety_badge(:disarmed).style.bg
nil

sim_style()

@spec sim_style() :: ExRatatui.Style.t()

Style for simulated joint indicators โ€” yellow.

Examples

iex> BB.TUI.Theme.sim_style().fg
:yellow

title_bg()

@spec title_bg() :: ExRatatui.Style.color()

Deep Elixir/BB violet used as the title bar background.

The hue is inspired by the Elixir logo and the Beam Bots hexdocs "purple" badge.

Examples

iex> BB.TUI.Theme.title_bg()
{:rgb, 78, 42, 90}

title_fg()

@spec title_fg() :: ExRatatui.Style.color()

Light lavender foreground used on top of the title bar background.

Examples

iex> BB.TUI.Theme.title_fg()
{:rgb, 230, 210, 245}

unfocused_border_style()

@spec unfocused_border_style() :: ExRatatui.Style.t()

Dim border style for inactive panels.

Examples

iex> BB.TUI.Theme.unfocused_border_style().fg
:dark_gray

yellow()

@spec yellow() :: ExRatatui.Style.color()

Yellow for transitional states (disarming).

Examples

iex> BB.TUI.Theme.yellow()
:yellow