function generateGradientText(input) {
let result = "\\textsf{";
const length = input.length;
for (let i = 0; i < length; i++) {
const r = (i / (length - 1)).toFixed(1); // Red value
const g = 0; // Green value (fixed)
const b = (1 - i / (length - 1)).toFixed(1); // Blue value
result += `\\color[rgb]{${r}, ${g}, ${b}}${input[i]}`;
}
result += '}';
return result;
}
// Example usage:
const inputString = "FULL TURBO";
const gradientText = generateGradientText(inputString);
console.log(gradientText);
Created
July 1, 2024 15:17
-
-
Save Hacksore/5632920d3139cd7113170b2a16417964 to your computer and use it in GitHub Desktop.
FULL TURBO
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment