Module gradient

Module gradient 

Source

Functions§

generate
Generates a horizontal gradient between two colors. This can be used for printing rainbow text or gradual transitions. This function returns a single string with the gradient applied. The text is split into characters, and each character is colored according to its position in the gradient. The gradient is calculated by interpolating between the start and end colors based on the character’s index. The result is a string where each character is styled with its corresponding color.
multi_color
Generates a gradient from a vector of colors, distributed across text. This function creates a gradient that transitions through multiple colors. The colors are evenly distributed across the text.
three_color
Generates a 3-color gradient (start -> mid, mid -> end) This function creates a gradient that transitions from the start color to the mid color, and then from the mid color to the end color.
two_color
Alias for generate() This function is a convenience function that calls the generate function with the provided text and colors. It returns the generated gradient string.