kakoune/doc/pages/faces.asciidoc

191 lines
5.6 KiB
Plaintext
Raw Normal View History

= 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
2016-02-10 22:03:49 +01:00
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 existing color:::
*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 (see below) 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:
2017-11-02 10:37:39 +01:00
*u*:::
Underline
*c*:::
Curly underline
Note: This takes precedence over underline if both are specified.
2017-11-02 10:37:39 +01:00
*r*:::
Reverse
2017-11-02 10:37:39 +01:00
*b*:::
Bold
2017-11-02 10:37:39 +01:00
*B*:::
Blink
2017-11-02 10:37:39 +01:00
*d*:::
Dim
2017-11-02 10:37:39 +01:00
*i*:::
Italic
2020-11-02 20:55:15 +01:00
*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 the rest of the face applies. Its value can be any
face name, as long as no cycle is introduced. A face can reference itself,
in which case it will apply on top 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.
2016-02-17 14:55:19 +01:00
*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 `\{`, and a literal
backslash `\` character that precedes a `{` character is escaped as well
(`\\`).
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}"
----