image.png

nodejs

https://www.npmjs.com/package/figlet
Github https://github.com/patorjk/figlet.js

  1. yarn add figlet
  2. const figlet = require('figlet');
  3. figlet('Hello World!!', function(err, data) {
  4. if (err) {
  5. console.log('Something went wrong...');
  6. console.dir(err);
  7. return;
  8. }
  9. console.log(data)
  10. })

figlet修改字体

  1. figlet.text('Boo!', {
  2. font: 'Ghost',
  3. horizontalLayout: 'default',
  4. verticalLayout: 'default',
  5. width: 80,
  6. whitespaceBreak: true
  7. }, function(err, data) {
  8. if (err) {
  9. console.log('Something went wrong...');
  10. console.dir(err);
  11. return;
  12. }
  13. console.log(data);
  14. });

figlet.org

http://www.figlet.org/
image.png

figlet 命令

  1. figlet [ -cklnoprstvxDELNRSWX ] [ -d fontdirectory ]
  2. [ -f fontfile ] [ -m smushmode ] [ -w outputwidth ]
  3. [ -C controlfile ] [ -I infocode ] [ message ]

Mac

  1. sudo brew install figlet