kakoune/doc/pages/faces.asciidoc

193 lines
5.7 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*
2022-07-24 23:59:56 +02:00
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.
2022-07-24 23:59:56 +02:00
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:
2017-11-02 10:37:39 +01:00
*u*:::
2022-07-24 23:59:56 +02:00
underline
*c*:::
2022-07-24 23:59:56 +02:00
curly underline
Note: This takes precedence over underline if both are specified.
2017-11-02 10:37:39 +01:00
*r*:::
2022-07-24 23:59:56 +02:00
reverse
2017-11-02 10:37:39 +01:00
*b*:::
2022-07-24 23:59:56 +02:00
bold
2017-11-02 10:37:39 +01:00
*B*:::
2022-07-24 23:59:56 +02:00
blink
2017-11-02 10:37:39 +01:00
*d*:::
2022-07-24 23:59:56 +02:00
dim
2017-11-02 10:37:39 +01:00
*i*:::
2022-07-24 23:59:56 +02:00
italic
2020-11-02 20:55:15 +01:00
*s*:::
2022-07-24 23:59:56 +02:00
strikethrough
*F*:::
2022-07-24 23:59:56 +02:00
final::::
Override the previous face instead of merging with it. Can
only be replaced if another face with the final attribute
is applied.
*f*:::
2022-07-24 23:59:56 +02:00
final foreground::::
Same as final, but only applies to a face's foreground color.
*g*:::
2022-07-24 23:59:56 +02:00
final background::::
Same as final, but only applies to a face's background color.
*a*:::
2022-07-24 23:59:56 +02:00
final attributes::::
Same as final, but only applies to a face's attributes.
base::
2022-07-24 23:59:56 +02:00
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*::
2022-07-24 23:59:56 +02:00
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.
*InlineInformation*::
Face for windows and messages displaying inline 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'
----
2022-07-24 23:59:56 +02:00
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}"
----