yed Install User Guide Developer Manual

This page describes the syntax that many yed systems use for defining attributes, which include colors and other text properties (bold, underline, etc.). Strings of this format are parsed by the core function yed_parse_attrs().

Definitions

  • 16-color: Terminals offer a customizable set of 16 colors (really 8, with 8 additional bright variants). These colors usually make up your terminal theme.
  • 256-color: An indexable set of 256 colors that almost every modern terminal will support. These will (almost always) be consistent across terminals, but they can change.
  • truecolor, 24-bit color, RGB: Consistent color selection defined by RGB. See this list of terminals that support this feature.
  • style component: A named set of attributes that can be pulled from a yed style. For example, code-keyword is the set of attributes that a style designates to be used for highlighting keywords.

Syntax

Color specification:

  • !COLOR: a color from the 16-color set, where COLOR is in the range [0,7].
  • @COLOR: a color from the 256-color set, where COLOR is in the range [0,255].
  • COLOR: an RGB color, where COLOR is a hex string indicating the [0,255] values for red, green, and blue respectively. Example: ff7f00 = full red, half green, no blue
The syntax of an attribute string consists of a set of space-separated commands. Each command modifies a working attribute, which begins as ZERO_ATTR, or no attributes. Below is the set of valid commands:
fg COLOR Set the foreground to COLOR (see above specification for COLOR).
bg COLOR Set the background to COLOR (see above specification for COLOR).
normal Reset all of inverse, bold, underline, 16-light-fg, and 16-light-bg.
inverse Instruct the terminal to render the colors inverted. This is not the same as swap, which literally swaps the attribute's colors.
no-inverse Unset the inverse flag.
bold Instruct the terminal to display the text using a bold font.
no-bold Unset the bold flag.
underline Underline the text.
no-underline Unset the underline flag.
16-light-fg Instruct the terminal to use the light variant of the foreground color. Only applies to 16-color selections.
no-16-light-fg Unset the light-16-fg flag.
16-light-bg Instruct the terminal to use the light variant of the background color. Only applies to 16-color selections.
no-16-light-bg Unset the light-16-bg flag.
swap Swap the foreground and background colors.
&SCOMP[.FIELD] Reference a style component from the currently active style. If .FIELD is used, only pull a specific color/flag from the style component. Examples:
  • "&popup": Use the style-designated attributes for a popup
  • "&active.bg": Use the active frame background color
  • "&code-string.bold": use bold if the style uses bold for highlighting strings
NOTE: You can run the command scomps-list to see a list of all style components.