From 28b41de2f491ef598197823c04fc7e86ae76a625 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Sun, 28 Aug 2022 12:30:35 +0530 Subject: fragment | Implement better autocmd management | refactor add a all_buffers option - colorizer will activate on all buffers, empty or not, still respect filetypes option handle errors when detach is called multiple times from the same buffer use bufdelete and bufdelete to remove the autocmds use a more efficient compile parse_fn function use custom ldoc template to generate vim help --- doc/modules/colorizer.color_utils.html | 355 +++++++++++++++++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100644 doc/modules/colorizer.color_utils.html (limited to 'doc/modules/colorizer.color_utils.html') diff --git a/doc/modules/colorizer.color_utils.html b/doc/modules/colorizer.color_utils.html new file mode 100644 index 0000000..613185c --- /dev/null +++ b/doc/modules/colorizer.color_utils.html @@ -0,0 +1,355 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.color_utils

+

Helper functions to parse different colour formats

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
color_is_bright (r, g, b)Determine whether to use black or white text.
color_name_parser (line, i)Grab all the colour values from vim.api.nvim_get_color_map and create a lookup table.
rgb_function_parser (line, i)Parse for rgb() css function and return rgb hex.
rgba_function_parser (line, i)Parse for rgba() css function and return rgb hex.
hsl_function_parser (line, i)Parse for hsl() css function and return rgb hex.
hsla_function_parser (line, i)Parse for hsl() css function and return rgb hex.
argb_hex_parser (line, i)parse for 0xaarrggbb and return rgb hex.
rgba_hex_parser (line, i, opts)parse for #rrggbbaa and return rgb hex.
+ +
+
+ + +

Functions

+ +
+
+ + color_is_bright (r, g, b) +
+
+ 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 +
  • +
+ + + + + +
+
+ + color_name_parser (line, i) +
+
+ Grab all the colour values from vim.api.nvim_get_color_map and create a lookup table. + COLOR_MAP is used to store the colour values + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ + + + + +
+
+ + rgb_function_parser (line, i) +
+
+ Parse for rgb() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the rgb function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + rgba_function_parser (line, i) +
+
+ Parse for rgba() css function and return rgb hex. + Todo consider removing the regexes here + Todo this might not be the best approach to alpha channel. + Things like pumblend might be useful here. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the rgba function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + hsl_function_parser (line, i) +
+
+ Parse for hsl() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the hsl function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + hsla_function_parser (line, i) +
+
+ Parse for hsl() css function and return rgb hex. + + +

Parameters:

+
    +
  • line + string: Line to parse +
  • +
  • i + number: Index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: Index of line where the hsla function ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + argb_hex_parser (line, i) +
+
+ parse for 0xaarrggbb and return rgb hex. + a format used in android apps + + +

Parameters:

+
    +
  • line + string: line to parse +
  • +
  • i + number: index of line from where to start parsing +
  • +
+ +

Returns:

+
    +
  1. + number|nil: index of line where the hex value ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + rgba_hex_parser (line, i, opts) +
+
+ parse for #rrggbbaa and return rgb hex. + a format used in android apps + + +

Parameters:

+
    +
  • line + string: line to parse +
  • +
  • i + number: index of line from where to start parsing +
  • +
  • opts + table: Containing minlen, maxlen, valid_lengths +
  • +
+ +

Returns:

+
    +
  1. + number|nil: index of line where the hex value ended
  2. +
  3. + string|nil: rgb hex value
  4. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +Last updated 2022-09-03 17:24:13 +
+
+ + -- cgit v1.2.3-70-g09d2