1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-25 21:16:38 +03:00
kakoune/doc/pages/faces.asciidoc
2022-07-26 13:42:28 -07:00

190 lines
5.6 KiB
Plaintext

= Faces
== Declaration
A *face* determines how text is displayed. It has a foreground color,
a background color, and some attributes. The value of a face has the
following format:
-----------------------------------------------------------
[fg_color][,bg_color[,underline_color]][+attributes][@base]
-----------------------------------------------------------
fg_color, bg_color, underline_color::
A color whose value can be:
A named color:::
*black*, *red*, *green*, *yellow*, *blue*, *magenta*, *cyan*,
*white* *bright-black*, *bright-red*, *bright-green*,
*bright-yellow* *bright-blue*, *bright-magenta*, *bright-cyan*,
*bright-white*
The color of the base face (see below):::
*default*
A hexadecimal value:::
*rgb:RRGGBB*, *rgba:RRGGBBAA*
If left unspecified, the value of *default* is used.
Alpha values are used to blend the face onto either its base or else onto
whatever color happens to be used at the moment. For technical reasons,
alpha values must be >16.
attributes::
A string whose individual letters each set an attribute:
*u*:::
underline
*c*:::
curly underline
Note: This takes precedence over underline if both are specified.
*r*:::
reverse
*b*:::
bold
*B*:::
blink
*d*:::
dim
*i*:::
italic
*s*:::
strikethrough
*F*:::
final::::
Override the previous face instead of merging with it. Can
only be replaced if another face with the final attribute
is applied.
*f*:::
final foreground::::
Same as final, but only applies to a face's foreground color.
*g*:::
final background::::
Same as final, but only applies to a face's background color.
*a*:::
final attributes::::
Same as final, but only applies to a face's attributes.
base::
The face onto which other faces apply. Its value can be any face name,
as long as no cycle is introduced. A face can reference itself, in which
case it'll apply on top of the version of the parent scope.
== Built-in faces
The following faces are used by color schemes to highlight certain areas of
the user interface:
*Default*::
default colors:::
The default foreground and background colors. If the value of *default*
is used here, then the colors used will be your terminal's defaults.
*PrimarySelection*::
Main selection face for every selected character except the cursor.
*SecondarySelection*::
Secondary selection face for every selected character except the cursor.
*PrimaryCursor*::
Cursor of the primary selection.
*SecondaryCursor*::
Cursor of the secondary selection.
*PrimaryCursorEol*::
Cursor of the primary selection when it lies on an EOL (end of line)
character.
*SecondaryCursorEol*::
Cursor of the secondary selection when it lies on an EOL (end of line)
character.
*MenuForeground*::
Face for items selected in menus.
*MenuBackground*::
Face for items not selected in menus.
*MenuInfo*::
Face for the additional information displayed when selecting items in menus.
*Information*::
Face for windows and messages displaying other information.
*Error*::
Face for errors reported by Kakoune in the status line.
*DiagnosticError*::
Face for errors reported by external tools in the buffer.
*DiagnosticWarning*::
Face for warnings reported by external tools in the buffer.
*StatusLine*::
Face for the status line.
*StatusLineMode*::
Face for the current mode, except normal mode.
*StatusLineInfo*::
Face for special information.
*StatusLineValue*::
Face for special values (numeric prefixes, registers, etc.).
*StatusCursor*::
Face for the status line cursor.
*Prompt*::
Face for the prompt displayed on the status line.
*BufferPadding*::
Face applied on the *~* characters that follow the last line of a buffer.
=== Built-in highlighter faces
The following faces are used by built-in highlighters if enabled.
(See <<highlighters#,`:doc highlighters`>>).
*LineNumbers*::
Face used by the *number-lines* highlighter.
*LineNumberCursor*::
Face used to highlight the line number of the main selection.
*LineNumbersWrapped*::
Face used to highlight the line number of wrapped lines.
*MatchingChar*::
Face used by the *show-matching* highlighter.
*Whitespace*::
Face used by the *show-whitespaces* highlighter.
*WrapMarker*::
Face used by the *wrap-marker* highlighter.
== Markup strings
In certain contexts, Kakoune can understand markup strings, which are strings
containing formatting information. In these strings, the {facename} syntax
will enable the face facename until another face gets activated, or the end
of the string is reached.
For example, the following command displays the text "default" in the
*Default* face, and "error" in the *Error* face:
----
echo -markup 'default {Error}error{Default} default'
----
Inside a markup string, a literal `{` character is written as `\{`, and a
literal backslash (`\`) character is written as `\\`.
The `{\}` string disables markup processing for the rest of the line. It
can be used to avoid having to escape text that might be mistaken for markup
instructions.
For example, this will prevent any `{` in the current buffer name from being
incorrectly interpreted as markup.
----
echo -markup "{Information}name:{\} %val{bufname}"
----