Man color pattern

From LSWiki

Revision as of 16:07, 11 June 2007; Laine (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Jump to: navigation, search

Contents

Files

/def/descriptor/color_pattern.c
/lib/descriptors/color_pattern.h
/std/def/term.c
/mod/definition/ansi_term.c
/daemon/color.c
/std/def/color_texture.c
/std/def/color_template.c
/def/color_texture
/def/color_template

Description

Color pattern descriptors are used internally by the terminal processing code. There is no need for user code to interact with them, and only core systems developers working on the terminal processing system will need to know about them. The most likely scenario for someone needing to work with them is if a new definition needs to be added to /def/color_texture or /def/color_template, though working from example should usually suffice.

The term "color", as used below, means one of four things. First, it may be a string color as normally handled by the terminal system. Second, it may be a color pattern descriptor. Third, in the case of patterns used by color templates, it may be one of the integer macros which is used to specify where color template arguments should be substituted, these macros being Color_Pattern_Template_Argument_1 through 8. Fourth, when color patterns are converted and cached by /mod/definition/ansi_term.c, the colors in them are rewritten to ANSI escape sequences; this is not normally something anyone needs to be concerned about.

Public Fields

Color_Pattern_Type: The type of color pattern. The types are:

   Color_Pattern_Solid: A simple color block.  The pattern content is the
   color to apply.  Any of the various meanings of "color" will be handled
   correctly, though in the case where the pattern content is another
   color pattern descriptor, the descriptor enclosing it is redundant.
   Color_Pattern_Alternation: A set of colors which will be "stretched"
   across their affected area so that the set is passed through no more
   than once.  The pattern content is an array of two or more colors.
   Color_Pattern_Sequence: A set of colors which is processed at a rate of
   one character per element, so the sequence is followed exactly and is
   repeated as necessary to cover the area affected.  The pattern content
   is an array of two or more colors.
   Color_Pattern_Centered: Two colors, a middle color and an edge color;
   the middle color is spread over a specific percentage of the affected
   area, with the edge color for the remainder.  The pattern content is
   an array of exactly two colors; the first is the middle color and the
   second is the edge color.  Color_Pattern_Spec is the percentage to
   cover with the middle color.

Color_Pattern_Content: The pattern content. The exact interpretation of the pattern content depends on the pattern type, as described under each individual type.

Color_Pattern_Spec: A value specification for the color pattern. Used by centered color patterns for the percentage of affected area to cover with the "middle" color.

Internal Fields

Color_Pattern_Pos: The position within the pattern that the descriptor is currently on. The terminal processing internals use this field, and it is not relevant to someone defining a color texture or color template.

Color_Pattern_Tag: The tag for the descriptor system.

Support Functions

void Color_Pattern_Reset(descriptor dxr)

Resets the Color_Pattern_Pos of the specified descriptor, and any further descriptors contained in its Color_Pattern_Content, to 0.

string Color_Pattern_Code(descriptor dxr)

Attempts to return the terminal-control string that would produce the color pattern given in the descriptor. It is possible to construct color pattern descriptors as abstract data that are impossible to produce from a terminal-control string, so it is safest to only use this function with color patterns which are known to have been derived originally from terminal-control strings.

See Also

descriptors(mechanisms)

Personal tools