Module colorizer.utils

Provides utility functions for color handling and file operations.

This module contains helper functions for checking byte categories, merging tables, parsing colors, managing file watchers, and handling buffer lines.

Functions

byte_is_alphanumeric (byte) Checks if a byte represents an alphanumeric character.
byte_is_hex (byte) Checks if a byte represents a hexadecimal character.
byte_is_valid_colorchar (byte) Checks if a byte is valid as a color character (alphanumeric or `-` for Tailwind colors).
count (str, pattern) Count the number of character in a string
get_last_modified (path) Get last modified time of a file
parse_hex (byte) Parses a hexadecimal byte.
watch_file (path, callback, ...) Watch a file for changes and execute callback
bufme (bufnr) Validates and returns a buffer number.


Functions

byte_is_alphanumeric (byte)
Checks if a byte represents an alphanumeric character.

Parameters:

  • byte number The byte to check.

Returns:

    boolean `true` if the byte is alphanumeric, otherwise `false`.
byte_is_hex (byte)
Checks if a byte represents a hexadecimal character.

Parameters:

  • byte number The byte to check.

Returns:

    boolean `true` if the byte is hexadecimal, otherwise `false`.
byte_is_valid_colorchar (byte)
Checks if a byte is valid as a color character (alphanumeric or `-` for Tailwind colors).

Parameters:

  • byte number The byte to check.

Returns:

    boolean `true` if the byte is valid, otherwise `false`.
count (str, pattern)
Count the number of character in a string

Parameters:

  • str string
  • pattern string

Returns:

    number
get_last_modified (path)
Get last modified time of a file

Parameters:

  • path string: file path

Returns:

    number|nil: modified time
parse_hex (byte)
Parses a hexadecimal byte.

Parameters:

  • byte number The byte to parse.

Returns:

    number The parsed hexadecimal value of the byte.
watch_file (path, callback, ...)
Watch a file for changes and execute callback

Parameters:

  • path string: File path
  • callback function: Callback to execute
  • ... table: params for callback

Returns:

    uv_fs_event_t|nil
bufme (bufnr)
Validates and returns a buffer number. If the provided buffer number is invalid, defaults to the current buffer.

Parameters:

  • bufnr number|nil: The buffer number to validate.

Returns:

    number The validated buffer number.
generated by LDoc 1.5.0 Last updated - December