Default Theme Functions
These functions are designed to be used by the default theme, but are documented here so that other themes can use these functions to reduce duplication if sections from the default theme are wanted.
Theme Functions
- _lp_default_theme_activate()
Setup the defaults and static pieces of the default theme.
Uses colors:
And marks:
New in version 2.0.
- _lp_default_theme_directory()
Setup the colors for the directory when the current working directory changes.
Uses colors:
And mark
LP_MARK_PERM
.New in version 2.0.
- _lp_default_theme_prompt()
Runs
_lp_default_theme_prompt_data()
then_lp_default_theme_prompt_template()
.New in version 2.0.
- _lp_default_theme_prompt_data()
Runs all of the below theme data functions, and writes values to the Default Theme variables. Can be used to generate all the default theme sections, then modify them before running a user template.
New in version 2.0.
- _lp_default_theme_prompt_template()
If
LP_PS1_FILE
is set, sources it.Then, if
LP_PS1
is set, uses it asPS1
. Otherwise, uses the default theme layout to constructPS1
. Can be used to set different template sections than the default theme, but still use the same template engine.New in version 2.0.
Theme Data Functions
These functions wrap Data Functions with color and/or other formatting. Their return codes are the same as the data functions they wrap unless otherwise documented.
The interface of the functions will not change between minor versions, but the specific text and formatting may change.
- _lp_analog_time_color() var:lp_analog_time_color
Returns
_lp_analog_time()
with color fromLP_COLOR_TIME
.New in version 2.0.
- _lp_aws_profile_color() var:lp_aws_profile_color
Returns
_lp_aws_profile()
with color fromLP_COLOR_AWS_PROFILE
.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_battery_color() var:lp_battery_color
Returns data from
_lp_battery()
, colored with:And using marks:
Adds battery value if
LP_PERCENTS_ALWAYS
is1
.Changed in version 2.0: Return code matches data function. Return method changed from stdout.
- _lp_cmake_color() var:lp_cmake_color
Returns data from
_lp_cmake()
. lp_cmake_compiler and lp_cmake_generator are colored according to their hash (see_lp_hash_color()
). lp_cmake_buildtype has as configurable color, depending on its value:Debug, colored with
LP_COLOR_CMAKE_DEBUG
(magenta, by default),RelWithDebInfo, colored with
LP_COLOR_CMAKE_RWDI
(blue, by default),Release, colored with
LP_COLOR_CMAKE_RELEASE
(cyan, by default),any other value would be colored according to its hash.
New in version 2.2.
- _lp_container_color() var:_lp_container_color
Returns
_lp_container()
, surrounded by « and » colored withLP_COLOR_CONTAINER
if the value is true. Returns no data if the value is false.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_dev_env_color() var:lp_dev_env_color
Assemble data related to development environment and returns a single string. The returned string starts with
LP_MARK_DEV_OPEN
and ends withLP_MARK_DEV_CLOSE
, with each section separated byLP_MARK_DEV_MID
.Data are collected from:
New in version 2.2.
- _lp_dirstack_color() var:lp_dirstack_color
Returns
_lp_dirstack()
, prefixed withLP_MARK_DIRSTACK
, all colored withLP_COLOR_DIRSTACK
.New in version 2.0.
- _lp_disk_color() var:lp_disk_color
Returns information about available space of the hard drive hosting the current directory.
If
LP_ALWAYS_DISPLAY_VALUES
isfalse
, displays a colored mark (usingLP_MARK_DISK
), if the available disk space goes belowLP_DISK_THRESHOLD
orLP_DISK_THRESHOLD_PERC
. If it istrue
, displays the corresponding value, either as a percentage (ifLP_DISPLAY_VALUES_AS_PERCENTS
istrue
) or as a human-readable quantity (ifLP_DISPLAY_VALUES_AS_PERCENTS
isfalse
).The mark and the value itself are colored with
LP_COLOR_DISK
, while the unit is colored withLP_COLOR_DISK_UNITS
.New in version 2.2.
- _lp_env_vars_color() var:lp_env_vars_color
Returns the elements of the array set by
_lp_env_vars()
, joined with theLP_MARK_ENV_VARS_SEP
marker, and surrounded byLP_MARK_ENV_VARS_OPEN
andLP_MARK_ENV_VARS_CLOSE
.If a matching environment variable is set, it is colored with
LP_COLOR_ENV_VARS_SET
, if it is unset, it is colored withLP_COLOR_ENV_VARS_UNSET
.See also
LP_ENV_VARS
.New in version 2.2.
- _lp_error_color() var:lp_error_color
Returns
_lp_error()
with color fromLP_COLOR_ERR
.New in version 2.0.
- _lp_error_meaning_color() var:lp_error_meaning_color
Returns
_lp_error_meaning()
with color fromLP_COLOR_ERR
and surrounded by parentheses.New in version 2.2.
- _lp_hostname_color() var:lp_hostname_color
Returns
_lp_hostname()
, with added data from_lp_chroot()
. Color fromLP_COLOR_HOST
,LP_COLOR_SSH
,LP_COLOR_HOST_HASH
, andLP_COLOR_TELNET
, depending on the output of_lp_connection()
.Added color from
_lp_connected_display()
: eitherLP_COLOR_X11_ON
orLP_COLOR_X11_OFF
.Return code is
_lp_hostname()
ORed with_lp_chroot()
: both must return no data for_lp_hostname_color()
to return no data.New in version 2.0.
- _lp_http_proxy_color() var:lp_http_proxy_color
Returns
_lp_http_proxy()
with color fromLP_COLOR_PROXY
.New in version 2.0.
- _lp_jobcount_color() var:lp_jobcount_color
Returns
_lp_detached_sessions()
with color fromLP_COLOR_JOB_D
and_lp_jobcount()
with colors fromLP_COLOR_JOB_R
andLP_COLOR_JOB_Z
.Return code is
_lp_detached_sessions()
ORed with_lp_jobcount()
: both must return no data for_lp_jobcount_color()
to return no data.Changed in version 2.0: Return code matches data function. Return method changed from stdout.
- _lp_kubernetes_context_color() var:lp_kubernetes_context_color
Returns data from
_lp_kubernetes_context()
, colored withLP_COLOR_KUBECONTEXT
and using markLP_MARK_KUBECONTEXT
.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_load_color() var:lp_load_color
Returns
_lp_load()
with color fromLP_COLORMAP
and mark fromLP_MARK_LOAD
.Adds load value if
LP_PERCENTS_ALWAYS
is1
.Changed in version 2.0: Return code matches data function. Return method changed from stdout.
- _lp_node_env_color() var:lp_node_env_color
Returns
_lp_node_env()
with color fromLP_COLOR_NODE_VENV
.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_os_color() var:lp_os_color
Gather information about the Operating System.
Any string encountered in the process may be replaced by a user-defined counterpart, using the
LP_MARK_OS
configuration array.If the string was not replaced, it is colored with a random color depending on its hash (see
_lp_hash_color()
).All fields gathered via the
_lp_os()
function are joined with theLP_MARK_OS_SEP
string, in the following order: arch, family, kernel, distribution, codename. The corresponding data are returned as a single string via thelp_os_color
variable.The function returns
2
if the user disabled the feature withLP_ENABLE_OS
,1
if no field was filled in with data, andtrue
otherwise.New in version 2.2.
- _lp_python_env_color() var:lp_python_env_color
Returns
_lp_python_env()
with color fromLP_COLOR_VIRTUALENV
.New in version 2.0.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_ram_color() var:lp_ram_color
Returns information about available RAM.
If
LP_ALWAYS_DISPLAY_VALUES
isfalse
, displays a colored mark (usingLP_MARK_RAM
), if the available ram goes belowLP_RAM_THRESHOLD
orLP_RAM_THRESHOLD_PERC
. If it istrue
, displays the corresponding value, either as a percentage (ifLP_DISPLAY_VALUES_AS_PERCENTS
istrue
) or as a human-readable quantity (ifLP_DISPLAY_VALUES_AS_PERCENTS
isfalse
).The mark and the value itself are colored with
LP_COLOR_RAM
, while the unit is colored withLP_COLOR_RAM_UNITS
.New in version 2.2.
- _lp_perl_env_color() var:lp_perl_env_color
Returns
_lp_perl_env()
with color fromLP_COLOR_PERL_VENV
.New in version 2.2.
- _lp_ruby_env_color() var:lp_ruby_env_color
Returns
_lp_ruby_env()
with color fromLP_COLOR_RUBY_VENV
.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_runtime_color() var:lp_runtime_color
Returns
_lp_runtime_format()
with color fromLP_COLOR_RUNTIME
.Changed in version 2.0: Renamed from
_lp_runtime
. Return code matches data function. Return method changed from stdout.
- _lp_shell_level_color() var:lp_shell_level_color
Returns
_lp_shell_level()
, prefixed withLP_MARK_SHLVL
, all colored withLP_COLOR_SHLVL
.New in version 2.1.
- _lp_software_collections_color() var:lp_software_collections_color
Returns
_lp_software_collections()
with color fromLP_COLOR_VIRTUALENV
.New in version 2.0.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_sudo_active_color() var:lp_sudo_active_color
Returns
_lp_sudo_active()
with color and marks fromLP_COLOR_MARK_SUDO
ifsudo
is active, orLP_COLOR_MARK_NO_SUDO
if not.Does not return
1
ifsudo
is not active, as the return string is still needed.Changed in version 2.0: Renamed from
_lp_sudo_check
. Always defined instead of only whenLP_ENABLE_SUDO
is enabled. Return variable changed fromLP_COLOR_MARK
.
- _lp_temperature_color() var:lp_temperature_color
Returns
_lp_temperature()
with color fromLP_COLORMAP
and mark fromLP_MARK_TEMP
.Changed in version 2.0: Renamed from
_lp_temperature
. Return code matches data function. Return method changed from stdout.
- _lp_terraform_env_color() var:lp_terraform_env_color
Returns
_lp_terraform_env()
with color fromLP_COLOR_TERRAFORM
.New in version 2.1.
Changed in version 2.2: No longer include squared brackets, superseded by
LP_MARK_DEV_OPEN
,LP_MARK_DEV_MID
andLP_MARK_DEV_CLOSE
.
- _lp_time_color() var:lp_time_color
Returns
_lp_time()
with color fromLP_COLOR_TIME
.New in version 2.0.
- _lp_vcs_details_color() var:lp_vcs_details_color
Returns data from all generic Version Control Data Functions, colored with:
And using marks:
This function should only be called when in a VCS repository; use
_lp_find_vcs()
or_lp_vcs_active()
before.The return code is undefined; a string should always be returned.
New in version 2.0.
- _lp_wifi_signal_strength_color() var:lp_wifi_signal_strength_color
Returns
_lp_wifi_signal_strength()
with color fromLP_COLORMAP
and mark fromLP_MARK_WIFI
.New in version 2.1.