aboutsummaryrefslogtreecommitdiff
path: root/doc/colorizer.txt
diff options
context:
space:
mode:
authorakianonymus <anonymus.aki@gmail.com>2023-02-27 14:30:10 +0530
committerakianonymus <anonymus.aki@gmail.com>2023-02-27 16:01:48 +0530
commitdde3084106a70b9a79d48f426f6d6fec6fd203f7 (patch)
treef1b06f0921e9eaf98bcc94f4d86d9f4d7226cb54 /doc/colorizer.txt
parentfix: virtualtext on nonfocused window update | #41 (diff)
Separate parsers into individual files
Diffstat (limited to 'doc/colorizer.txt')
-rw-r--r--doc/colorizer.txt231
1 files changed, 148 insertions, 83 deletions
diff --git a/doc/colorizer.txt b/doc/colorizer.txt
index a7d21b5..491e5b5 100644
--- a/doc/colorizer.txt
+++ b/doc/colorizer.txt
@@ -412,34 +412,124 @@ default_namespace *colorizer.buffer.default_namespace*
==============================================================================
COLOR *colorizer.color-introduction*
-Helper functions to parse different colour formats
+Helper color functions
==============================================================================
LUA API *colorizer.color-lua-api*
Functions: ~
- |argb_hex_parser| - parse for 0xaarrggbb and return rgb hex.
-
|hsl_to_rgb| - Converts an HSL color value to RGB.
- |hsl_function_parser| - Parse for hsl() hsla() css function and return rgb
- hex.
-
|hue_to_rgb| - Convert hsl colour values to rgb.
|is_bright| - Determine whether to use black or white text.
- |name_parser| - Grab all the colour values from `vim.api.nvim_get_color_map`
- and create a lookup table.
- |rgb_function_parser| - Parse for rgb() rgba() css function and return rgb
- hex.
+hsl_to_rgb({h}, {s}, {l}) *colorizer.color.hsl_to_rgb*
+ Converts an HSL color value to RGB.
+
+ Parameters: ~
+ {h} - number: Hue
+ {s} - number: Saturation
+ {l} - number: Lightness
+
+ returns:~
+ number or nil,number or nil,number or nil
+
+
+
+hue_to_rgb({p}, {q}, {t}) *colorizer.color.hue_to_rgb*
+ Convert hsl colour values to rgb.
+
+ Source: https://gist.github.com/mjackson/5311256
+
+
+ Parameters: ~
+ {p} - number
+ {q} - number
+ {t} - number
+
+ returns:~
+ number
+
+
+
+is_bright({r}, {g}, {b}) *colorizer.color.is_bright*
+ Determine whether to use black or white text.
+
+
+ ref: https://stackoverflow.com/a/1855903/837964
+ https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color
+
+
+ Parameters: ~
+ {r} - number: Red
+ {g} - number: Green
+ {b} - number: Blue
+
+
+
+==============================================================================
+MATCHER *colorizer.matcher-introduction*
+
+Helper functions for colorizer to enable required parsers
+
+
+==============================================================================
+LUA API *colorizer.matcher-lua-api*
+
+Functions: ~
+ |compile| - Form a trie stuct with the given prefixes
+
+ |make| - Parse the given options and return a function with enabled parsers.
+
+
+compile({matchers}, {matchers_trie}) *colorizer.matcher.compile*
+ Form a trie stuct with the given prefixes
+
+ Parameters: ~
+ {matchers} - table: List of prefixes, {"rgb", "hsl"}
+ {matchers_trie} - table: Table containing information regarding
+ non-trie based parsers
+
+ returns:~
+ function: function which will just parse the line for enabled parsers
+
+
+
+make({options}) *colorizer.matcher.make*
+ Parse the given options and return a function with enabled parsers.
+
+ if no parsers enabled then return false
+ Do not try make the function again if it is present in the cache
- |rgba_hex_parser| - parse for #rrggbbaa and return rgb hex.
+ Parameters: ~
+ {options} - table: options created in `colorizer.setup`
-argb_hex_parser({line}, {i}) *colorizer.color.argb_hex_parser*
+ returns:~
+ function or boolean: function which will just parse the line for enabled
+ parsers
+
+
+
+==============================================================================
+ARGB_HEX *colorizer.parser.argb_hex-introduction*
+
+Helper function to parse argb
+
+
+==============================================================================
+LUA API *colorizer.parser.argb_hex-lua-api*
+
+Functions: ~
+ |parser.argb_hex_parser| - parse for 0xaarrggbb and return rgb hex.
+
+
+
+ *colorizer.parser.argb_hex.parser.argb_hex_parser*
+parser.argb_hex_parser({line}, {i})
parse for 0xaarrggbb and return rgb hex.
a format used in android apps
@@ -455,20 +545,23 @@ argb_hex_parser({line}, {i}) *colorizer.color.argb_hex_parser*
-hsl_to_rgb({h}, {s}, {l}) *colorizer.color.hsl_to_rgb*
- Converts an HSL color value to RGB.
+==============================================================================
+HSL *colorizer.parser.hsl-introduction*
- Parameters: ~
- {h} - number: Hue
- {s} - number: Saturation
- {l} - number: Lightness
+Helper function to parse argb
- returns:~
- number or nil,number or nil,number or nil
+
+==============================================================================
+LUA API *colorizer.parser.hsl-lua-api*
+
+Functions: ~
+ |parser.hsl_function_parser| - Parse for hsl() hsla() css function and
+ return rgb hex.
-hsl_function_parser({line}, {i}, {opts}) *colorizer.color.hsl_function_parser*
+ *colorizer.parser.hsl.parser.hsl_function_parser*
+parser.hsl_function_parser({line}, {i}, {opts})
Parse for hsl() hsla() css function and return rgb hex.
For more info:
@@ -486,38 +579,23 @@ hsl_function_parser({line}, {i}, {opts}) *colorizer.color.hsl_function_parser*
-hue_to_rgb({p}, {q}, {t}) *colorizer.color.hue_to_rgb*
- Convert hsl colour values to rgb.
-
- Source: https://gist.github.com/mjackson/5311256
-
-
- Parameters: ~
- {p} - number
- {q} - number
- {t} - number
-
- returns:~
- number
-
-
-
-is_bright({r}, {g}, {b}) *colorizer.color.is_bright*
- Determine whether to use black or white text.
+==============================================================================
+NAMES *colorizer.parser.names-introduction*
+Helper function to parse argb
- ref: https://stackoverflow.com/a/1855903/837964
- https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color
+==============================================================================
+LUA API *colorizer.parser.names-lua-api*
- Parameters: ~
- {r} - number: Red
- {g} - number: Green
- {b} - number: Blue
+Functions: ~
+ |parser.name_parser| - Grab all the colour values from
+ `vim.api.nvim_get_color_map` and create a lookup table.
-name_parser({line}, {i}, {opts}) *colorizer.color.name_parser*
+ *colorizer.parser.names.parser.name_parser*
+parser.name_parser({line}, {i}, {opts})
Grab all the colour values from `vim.api.nvim_get_color_map` and create a
lookup table.
@@ -531,25 +609,22 @@ name_parser({line}, {i}, {opts}) *colorizer.color.name_parser*
-rgb_function_parser({line}, {i}, {opts}) *colorizer.color.rgb_function_parser*
- Parse for rgb() rgba() css function and return rgb hex.
+==============================================================================
+RGBA_HEX *colorizer.parser.rgba_hex-introduction*
- For more info:
- https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb
+Helper function to parse argb
- Parameters: ~
- {line} - string: Line to parse
- {i} - number: Index of line from where to start parsing
- {opts} - table: Values passed from matchers like prefix
+==============================================================================
+LUA API *colorizer.parser.rgba_hex-lua-api*
- returns:~
- number or nil: Index of line where the rgb/rgba function ended
- string or nil: rgb hex value
+Functions: ~
+ |parser.rgba_hex_parser| - parse for #rrggbbaa and return rgb hex.
-rgba_hex_parser({line}, {i}, {opts}) *colorizer.color.rgba_hex_parser*
+ *colorizer.parser.rgba_hex.parser.rgba_hex_parser*
+parser.rgba_hex_parser({line}, {i}, {opts})
parse for #rrggbbaa and return rgb hex.
a format used in android apps
@@ -567,46 +642,36 @@ rgba_hex_parser({line}, {i}, {opts}) *colorizer.color.rgba_hex_parser*
==============================================================================
-MATCHER *colorizer.matcher-introduction*
+RGB *colorizer.parser.rgb-introduction*
-Helper functions for colorizer to enable required parsers
+Helper function to parse argb
==============================================================================
-LUA API *colorizer.matcher-lua-api*
+LUA API *colorizer.parser.rgb-lua-api*
Functions: ~
- |compile| - Form a trie stuct with the given prefixes
+ |parser.rgb_function_parser| - Parse for rgb() rgba() css function and
+ return rgb hex.
- |make| - Parse the given options and return a function with enabled parsers.
-compile({matchers}, {matchers_trie}) *colorizer.matcher.compile*
- Form a trie stuct with the given prefixes
-
- Parameters: ~
- {matchers} - table: List of prefixes, {"rgb", "hsl"}
- {matchers_trie} - table: Table containing information regarding
- non-trie based parsers
-
- returns:~
- function: function which will just parse the line for enabled parsers
-
-
-
-make({options}) *colorizer.matcher.make*
- Parse the given options and return a function with enabled parsers.
+ *colorizer.parser.rgb.parser.rgb_function_parser*
+parser.rgb_function_parser({line}, {i}, {opts})
+ Parse for rgb() rgba() css function and return rgb hex.
- if no parsers enabled then return false
- Do not try make the function again if it is present in the cache
+ For more info:
+ https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb
Parameters: ~
- {options} - table: options created in `colorizer.setup`
+ {line} - string: Line to parse
+ {i} - number: Index of line from where to start parsing
+ {opts} - table: Values passed from matchers like prefix
returns:~
- function or boolean: function which will just parse the line for enabled
- parsers
+ number or nil: Index of line where the rgb/rgba function ended
+ string or nil: rgb hex value