PhoenixGenApiTui.Theme (phoenix_gen_api_tui v0.1.0)

Copy Markdown View Source

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

Provides a consistent visual palette based on the PhoenixGenApi brand colors. All functions are pure and return a color tuple, an %ExRatatui.Style{}, an %ExRatatui.Text.Span{}, or an %ExRatatui.Text.Line{} โ€” never a side effect.

The palette is held internally as a single %ExRatatui.Theme{} struct; the color accessors below read individual slots from it, and the border styles delegate to ExRatatui.Theme.border_style/2.

Colors

Composite Styles

Rich Text

  • brand_title/1 - branded header line ("๐Ÿ”ฅ PhoenixGenApi TUI Explorer ยท breadcrumb")
  • resource_title/1 - dim-service + bold-function line for the tabs block
  • key_pill/2 - colored "key" pill %Span{} for footer / help hints
  • dim_span/1 - dim-text descriptor span between pills
  • footer_line/1 - assembles a %Line{} from a list of {keys, label} pairs

Summary

Functions

Returns focused_border_style/0 when focused? is true, unfocused_border_style/0 otherwise.

Branded header line โ€” ๐Ÿ”ฅ PhoenixGenApi TUI Explorer with an optional breadcrumb.

Cornflower blue, used for focused panel borders.

Muted border color for unfocused panels.

Dim span used between key pills in the footer / help.

Muted text color for secondary information.

Cornflower blue border style for the active/focused panel.

Builds a footer %Line{} from a list of {label, description} pairs.

Gold, used for highlights and selected items.

Subtle dark background for selected rows.

Bold gold text on a dark background, used for selected items.

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

Dark background for modal overlays.

PhoenixGenApi brand pink/magenta.

Title line for the detail (tabs) block โ€” the service prefix renders dim while the bare function name is bold gold.

Dim border style for inactive/unfocused panels.

Functions

border_style(focused?)

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

Returns focused_border_style/0 when focused? is true, unfocused_border_style/0 otherwise.

Examples

iex> PhoenixGenApiTui.Theme.border_style(true) == PhoenixGenApiTui.Theme.focused_border_style()
true

iex> PhoenixGenApiTui.Theme.border_style(false) == PhoenixGenApiTui.Theme.unfocused_border_style()
true

brand_title(breadcrumb)

@spec brand_title(String.t()) :: ExRatatui.Text.Line.t()

Branded header line โ€” ๐Ÿ”ฅ PhoenixGenApi TUI Explorer with an optional breadcrumb.

PhoenixGenApi renders in phoenix_pink/0 bold, TUI in gold/0 bold, Explorer in white, and the breadcrumb in cornflower/0 bold separated by a dim โ”‚.

Examples

iex> %ExRatatui.Text.Line{spans: spans} = PhoenixGenApiTui.Theme.brand_title("")
iex> Enum.map(spans, & &1.content)
[" ๐Ÿ”ฅ ", "PhoenixGenApi", " ", "TUI", " ", "Explorer "]

iex> %ExRatatui.Text.Line{spans: spans} = PhoenixGenApiTui.Theme.brand_title("UserService")
iex> Enum.map_join(spans, "", & &1.content)
" ๐Ÿ”ฅ PhoenixGenApi TUI Explorer  โ”‚  UserService "

cornflower()

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

Cornflower blue, used for focused panel borders.

Examples

iex> PhoenixGenApiTui.Theme.cornflower()
{:rgb, 100, 149, 237}

dim_border()

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

Muted border color for unfocused panels.

Examples

iex> PhoenixGenApiTui.Theme.dim_border()
{:rgb, 60, 60, 80}

dim_span(text)

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

Dim span used between key pills in the footer / help.

Examples

iex> span = PhoenixGenApiTui.Theme.dim_span(" navigate")
iex> span.content
" navigate"
iex> span.style.fg == PhoenixGenApiTui.Theme.dim_text()
true

dim_text()

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

Muted text color for secondary information.

Examples

iex> PhoenixGenApiTui.Theme.dim_text()
{:rgb, 150, 150, 170}

focused_border_style()

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

Cornflower blue border style for the active/focused panel.

Examples

iex> style = PhoenixGenApiTui.Theme.focused_border_style()
iex> style.fg
{:rgb, 100, 149, 237}

gold()

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

Gold, used for highlights and selected items.

Examples

iex> PhoenixGenApiTui.Theme.gold()
{:rgb, 255, 215, 0}

highlight_bg()

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

Subtle dark background for selected rows.

Examples

iex> PhoenixGenApiTui.Theme.highlight_bg()
{:rgb, 40, 40, 60}

highlight_style()

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

Bold gold text on a dark background, used for selected items.

Examples

iex> style = PhoenixGenApiTui.Theme.highlight_style()
iex> style.fg
{:rgb, 255, 215, 0}
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 footer and help hints.

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

Examples

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

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

overlay_bg()

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

Dark background for modal overlays.

Examples

iex> PhoenixGenApiTui.Theme.overlay_bg()
{:rgb, 20, 20, 30}

phoenix_pink()

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

PhoenixGenApi brand pink/magenta.

Examples

iex> PhoenixGenApiTui.Theme.phoenix_pink()
{:rgb, 220, 50, 100}

resource_title(name)

@spec resource_title(String.t()) :: ExRatatui.Text.Line.t()

Title line for the detail (tabs) block โ€” the service prefix renders dim while the bare function name is bold gold.

Examples

iex> %ExRatatui.Text.Line{spans: spans} =
...>   PhoenixGenApiTui.Theme.resource_title("MyApp.Services.UserService")
iex> Enum.map(spans, & &1.content)
[" ", "MyApp.Services.", "UserService", " "]

iex> %ExRatatui.Text.Line{spans: [_, _, name, _]} =
...>   PhoenixGenApiTui.Theme.resource_title("Bare")
iex> name.content
"Bare"

iex> %ExRatatui.Text.Line{spans: [%{content: only}]} =
...>   PhoenixGenApiTui.Theme.resource_title("")
iex> only
" No service selected "

unfocused_border_style()

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

Dim border style for inactive/unfocused panels.

Examples

iex> style = PhoenixGenApiTui.Theme.unfocused_border_style()
iex> style.fg
{:rgb, 60, 60, 80}