diff --git a/docs/preset_components.md b/docs/preset_components.md new file mode 100644 index 0000000..475678c --- /dev/null +++ b/docs/preset_components.md @@ -0,0 +1,42 @@ +--- +title: Preset Components +description: Type description of care.preset_components +--- + +# Preset Components + +This module contains some high-level components for easily creating `format_entry` functions. +# `care.preset_components` + +# Methods + +## ShortcutLabel +`preset_components.ShortcutLabel(labels: string[], entry: care.entry, data: care.format_data, highlight_group?: string): { [1]: string, [2]: string }[]` + +See [care.entry](/dev/entry) + +This adds a label for shortcuts [described here](/configuration_recipes#labels-and-shortcuts). By default this will +use the `Comment` highlight group. This can be overridden though. + +## KindIcon +`preset_components.KindIcon(entry: care.entry, style?: "blended"|"fg"): { [1]: string, [2]: string }[]` + +See [care.entry](/dev/entry) + +This components displays a kind icon. You can choose between the blended and foreground style. + +## Label +`preset_components.Label(entry: care.entry, data: care.format_data, display_colored_block?: boolean): { [1]: string, [2]: string }[]` + +See [care.entry](/dev/entry) + +This adds a completion item label to be displayed. Optionally this can also include a colored block if the items +is a color and we know the value of the color. + +## ColoredBlock +`preset_components.ColoredBlock(entry: care.entry, character?: string): { [1]: string, [2]: string }[]` + +See [care.entry](/dev/entry) + +This component adds a colored block for the item if it is a color. The character used for the block can +optionally be configured. \ No newline at end of file diff --git a/docs/preset_utils.md b/docs/preset_utils.md new file mode 100644 index 0000000..7627d74 --- /dev/null +++ b/docs/preset_utils.md @@ -0,0 +1,40 @@ +--- +title: Preset Utils +description: Type description of care.preset_utils +--- + +# Preset Utils + +This module contains lower level utilities for the presets and the preset components. +# `care.preset_utils` + +# Methods + +## Label Entries +`preset_utils.label_entries(labels: string[]): fun(_,data: care.format_data): string` + +This function can be used to get a function to label the entries with shortscuts as [described +here](/configuration_recipes#labels-and-shortcuts). + +## Get Color +`preset_utils.get_color(entry: care.entry): string?` + +See [care.entry](/dev/entry) + +With this function you can get a color if the entry is a color and the hex color code is available in the +completion item. + +## Get Highlight For Hex +`preset_utils.get_highlight_for_hex(hex: string): string` + +This function allows to get a highlight group for a certain hex color code. This is useful because like that the +user doesn't have to constantly create new highlight groups to apply a hex value to a certain thing. The +highlight group will have the hex value as foregroung color. + +## Kind Highlight +`preset_utils.kind_highlight(entry: care.entry, style: "fg"|"blended")` + +See [care.entry](/dev/entry) + +With this function you can get the kind highlight group for a specific entry. The style can either be foreground +or blended. \ No newline at end of file diff --git a/docs/presets.md b/docs/presets.md new file mode 100644 index 0000000..4430958 --- /dev/null +++ b/docs/presets.md @@ -0,0 +1,27 @@ +--- +title: Presets +description: Type description of care.presets +--- + +# Presets + +In this module some presets for the format_entry function are available. +# `care.presets` + +# Methods + +## Default +`presets.Default(entry: care.entry, data: care.format_data): { [1]: string, [2]: string }[][]` + +See [care.entry](/dev/entry) + +The default preset. Just includes the label and a simple icon. + +## Atom +`presets.Atom(entry: care.entry, data: care.format_data): { [1]: string, [2]: string }[][]` + +See [care.entry](/dev/entry) + +The atom preset is an atom-like configuration. It displays the kind icon with a blended colored background and +the labelatom preset is an atom-like configuration. It displays the kind icon with a blended colored background +and the label. \ No newline at end of file