[github地址:https://github.com/ABCDdouyae...]git
用於在終端打印出好看的漸變文字
console.log(gradient('cyan', 'pink')('Hello world!')); let a = 'so beautiful!' let b = gradient('red', 'green'); console.log(b(a)); let c = gradient(['yellow', 'orange']); console.log(c(a));
let coolGradient = gradient([ tinycolor('#FFBB65'), // tinycolor object {r: 0, g: 255, b: 0}, // RGB object {h: 240, s: 1, v: 1, a: 1}, // HSVa object 'rgb(120, 120, 0)', // RGB CSS string 'gold' // named color ]);
console.log(gradient.rainbow('It\'s a rainbow!'))
let arr = [ ' 。*☆∴。 。∴☆*。', ' 。★*゚゚*★∵★*゚゚*★。', ' ☆゚ ゚☆゚ ゚☆', ' ★* ♡ I. ♡ *★ ', ' ゚☆。♥ LOVE. ♥ 。 ☆゚', ' *★。♡F.C.F♡ 。★*', ' ∵☆。 。☆∵', ' ゚*★。。★*゚', ' ゚*☆ ', ]; console.log(gradient('#fff', '#000').multiline(arr.join('\n')))
let colorPool = gradient([ {color:'#fff', pos: 0.1}, {color:'red', pos: 0.7}, {color:'yellow', pos: 1} ]); console.log(colorPool.multiline(arr.join('\n')));
const redToGreen = gradient('red', 'green'); const str = '■'.repeat(48); console.log(redToGreen(str)); console.log(redToGreen(str, {interpolation: 'hsv'})); console.log(redToGreen(str, {interpolation: 'hsv', hsvSpin: 'long'}));