pub struct HighlightingAssets { /* private fields */ }

Implementations

The default theme.

Windows and Linux

Windows and most Linux distributions has a dark terminal theme by default. On these platforms, this function always returns a theme that looks good on a dark background.

macOS

On macOS the default terminal background is light, but it is common that Dark Mode is active, which makes the terminal background dark. On this platform, the default theme depends on

defaults read -globalDomain AppleInterfaceStyle

To avoid the overhead of the check on macOS, simply specify a theme explicitly via --theme, BAT_THEME, or ~/.config/bat.

See https://github.com/sharkdp/bat/issues/1746 and https://github.com/sharkdp/bat/issues/1928 for more context.

Return the collection of syntect syntax definitions.

👎 Deprecated

Use Self::get_syntaxes instead

👎 Deprecated

Detect the syntax based on, in order:

  1. Syntax mappings with MappingTarget::MapTo and MappingTarget::MapToUnknown (e.g. /etc/profile -> Bourne Again Shell (bash))
  2. The file name (e.g. Dockerfile)
  3. Syntax mappings with MappingTarget::MapExtensionToUnknown (e.g. *.conf)
  4. The file name extension (e.g. .rs)

When detecting syntax based on syntax mappings, the full path is taken into account. When detecting syntax based on file name, no regard is taken to the path of the file. Only the file name itself matters. When detecting syntax based on file name extension, only the file name extension itself matters.

Returns Error::UndetectedSyntax if it was not possible detect syntax based on path/file name/extension (or if the path was mapped to MappingTarget::MapToUnknown or MappingTarget::MapExtensionToUnknown). In this case it is appropriate to fall back to other methods to detect syntax. Such as using the contents of the first line of the file.

Returns Error::UnknownSyntax if a syntax mapping exist, but the mapped syntax does not exist.

Look up a syntect theme by name.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.