Gradientty::ColorInstance
Represents a gradient color instance for rendering strings with color transitions.
Create an instance using Gradientty.gradient(["#hex1", "#hex2", ...]).
Use #call for single-line strings or #multiline for multi-line strings.
Constructors
Instance methods
Applies the gradient to a single-line string.
Spaces and newlines are preserved. The string is returned with ANSI color codes applied.
str - The string to apply the gradient to.
Example:
custom = Gradientty.gradient(["#ff0000", "#00ff00"])
puts custom.call("Hello")
The array of RGB color stops used for the gradient. Each color is an Array of three Int32 values: [R, G, B].
The array of RGB color stops used for the gradient. Each color is an Array of three Int32 values: [R, G, B].
Applies the gradient to a multi-line string.
Each line receives the full gradient individually by default. If continuous is true, the gradient flows continuously across all lines.
str - The multi-line string to color. continuous - Whether to apply gradient continuously across all lines (default: false).
Example:
custom = Gradientty.gradient(["#ff0000", "#00ff00", "#0000ff"])
puts custom.multiline("Hello\nWorld", true)