Set the active glyph/color theme
Arguments
- theme
Either a preset name (
"unicode","ascii","emoji") to swap the whole glyph set, or a named list of per-key overrides to merge onto the currently active theme (matching the two calling styles shown in the package documentation).- overrides
A named list of per-key overrides applied on top of
themeafter it is resolved. Each entry may specifyglyph,width, and/orcolor; unspecified fields are kept from the existing entry. Thegroupslot also acceptsbracket(logical, defaultFALSE): whenTRUEthe header name is wrapped in< >.- compact
Density of the tree's per-level indentation.
FALSE(the default) keeps the normal spacing (three columns per level in the unicode theme);"medium"drops the trailing gap after each connector (two columns per level);"tight"additionally slims the branch and corner connectors to a single character (one column per level).TRUEis an alias for"tight". Compact applies to the active (console) theme and is cleared by a subsequent preset swap such aslogtree_theme("unicode").
Details
An override list is keyed by slot; each slot's value is itself a named list of fields. Only the fields you name are changed – everything else is kept from the active theme.
Slots (valid names in an override / preset list):
| Slot | Applies to | Fields it accepts |
step | open / running step glyph | glyph, width, color |
info | log_info() leaf | glyph, width, color |
debug | log_debug() leaf | glyph, width, color |
success | success glyph (clean close, log_success()) | glyph, width, color |
warning | log_warn() / elevated step glyph | glyph, width, color |
error | log_error() / elevated step glyph | glyph, width, color |
interrupted | abnormal-exit (dimmed) glyph | glyph, width, color |
group | group header marker | glyph, color, bracket |
branch | child connector: the "tee" drawn before every child line | glyph, color |
corner | close-line connector: the "elbow" drawn on a step's own close line | glyph, color |
pipe | vertical rail carried down the left of nested lines | glyph, color |
Fields (valid names inside a slot):
| Field | Type | Accepted values |
glyph | character(1) | Any string, including "". In package source, non-ASCII must be written as \u/\U escapes, never literal characters. |
width | integer(1) | Rendered display width of glyph (1 for normal, 2 for emoji / wide cells). Drives column alignment and cannot be measured, so set it to the true width. Status slots only (step, info, debug, success, warning, error, interrupted). |
color | character or NULL | One or more cli styles, or NULL for no styling. Named colors ("red", "cyan", "silver", ...), bright variants ("br_red"), backgrounds ("bg_blue"), text styles ("bold", "italic", "dim"), or a hex string ("#ff8800"). A character vector combines styles, e.g. c("red", "bold"). See cli::combine_ansi_styles(). |
bracket | logical(1) | group slot only. TRUE wraps the header name in < >; default FALSE. |
