From cf4f33f5ea34f9c4e9975299b094f1a2b8b34aa0 Mon Sep 17 00:00:00 2001 From: Akianonymus Date: Thu, 15 Sep 2022 10:00:00 +0530 Subject: Better structure and naming | Misc improvements --- doc/modules/colorizer.color.html | 431 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 431 insertions(+) create mode 100644 doc/modules/colorizer.color.html (limited to 'doc/modules/colorizer.color.html') diff --git a/doc/modules/colorizer.color.html b/doc/modules/colorizer.color.html new file mode 100644 index 0000000..b36a8aa --- /dev/null +++ b/doc/modules/colorizer.color.html @@ -0,0 +1,431 @@ + + + + + colorizer Docs + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module colorizer.color

+

Helper functions to parse different colour formats

+

+ +

+ + +

Functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
argb_hex_parser (line, i)parse for 0xaarrggbb and return rgb hex.
hsl_to_rgb (h, s, l)Converts an HSL color value to RGB.
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.
hue_to_rgb (p, q, t)Convert hsl colour values to rgb.
is_bright (r, g, b)Determine whether to use black or white text.
name_parser (line, i, opts)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.
rgba_hex_parser (line, i, opts)parse for #rrggbbaa and return rgb hex.
+ +
+
+ + +

Functions

+ +
+
+ + 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. +
+ + + + +
+
+ + hsl_to_rgb (h, s, l) +
+
+ Converts an HSL color value to RGB. + + +

Parameters:

+
    +
  • h + number: Hue +
  • +
  • s + number: Saturation +
  • +
  • l + number: Lightness +
  • +
+ +

Returns:

+
    + + number|nil,number|nil,number|nil +
+ + + + +
+
+ + 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. +
+ + + + +
+
+ + hue_to_rgb (p, q, t) +
+
+ 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) +
+
+ 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 +
  • +
+ + + + + +
+
+ + name_parser (line, i, opts) +
+
+ 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 +
  • +
  • opts + table: Currently contains whether tailwind is enabled or not +
  • +
+ + + + + +
+
+ + 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. +
+ + + + +
+
+ + 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 - September +
+
+ + -- cgit v1.2.3-70-g09d2