| skipped 50 lines |
51 | 51 | | maxLength: '0', // define how many character can be on one line |
52 | 52 | | gradient: false, // define your two gradient colors |
53 | 53 | | independentGradient: false, // define if you want to recalculate the gradient for each new line |
| 54 | + | transitionGradient: false, // define if this is a transition between colors directly |
| 55 | + | env: 'node' // define the environment CFonts is being executed in |
54 | 56 | | }); |
55 | 57 | | ``` |
56 | 58 | | |
| skipped 226 lines |
283 | 285 | | Only works in combination with the [gradient](#-g---gradient) option. |
284 | 286 | | |
285 | 287 | | ```shell |
286 | | - | $ cfonts "text|next line" --gradient red,"#f80" --independentGradient |
| 288 | + | $ cfonts "text|next line" --gradient red,"#f80" --independent-gradient |
287 | 289 | | ``` |
288 | 290 | | |
289 | 291 | | ![Independent gradient command](https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/independent-gradient.png) |
| skipped 101 lines |
391 | 393 | | ![Max length command](https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/max-length.png) |
392 | 394 | | |
393 | 395 | | |
| 396 | + | #### -e, --env |
| 397 | + | Type: `<string>` |
| 398 | + | Default value: `node` |
| 399 | + | |
| 400 | + | This option let's you use CFonts to generate HTML instead of ANSI code. |
| 401 | + | Note that `max-length` won't be automatically detected anymore and you will have to supply it if you want the text to wrap. |
| 402 | + | Best used in a node script. |
| 403 | + | |
| 404 | + | ```js |
| 405 | + | const CFonts = require('cfonts'); |
| 406 | + | const path = require('path'); |
| 407 | + | const fs = require('fs'); |
| 408 | + | |
| 409 | + | const output = CFonts.render('My text', { |
| 410 | + | colors: ['white'], |
| 411 | + | gradient: ['cyan', 'red'], |
| 412 | + | background: 'black', |
| 413 | + | space: false, |
| 414 | + | env: 'browser', |
| 415 | + | }); |
| 416 | + | |
| 417 | + | fs.writeFileSync( |
| 418 | + | path.normalize(`${ __dirname }/test.html`), |
| 419 | + | output.string, |
| 420 | + | { |
| 421 | + | encoding: 'utf8', |
| 422 | + | } |
| 423 | + | ); |
| 424 | + | ``` |
| 425 | + | |
| 426 | + | ![Max length command](https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/env.png) |
| 427 | + | |
| 428 | + | |
394 | 429 | | ## Consistency |
395 | 430 | | [Chalk](https://github.com/chalk/chalk) detects what colors are supported on your platform. |
396 | 431 | | It sets a [level of support](https://github.com/chalk/chalk#256-and-truecolor-color-support) automatically. |
| skipped 76 lines |
473 | 508 | | |
474 | 509 | | |
475 | 510 | | ## Release History |
| 511 | + | * 2.7.8 - added environment support, added font `tiny` |
476 | 512 | | * 2.7.0 - added font `slick`, `grid` and `pallet`, added double quote to all fonts |
477 | 513 | | * 2.6.1 - fixed console `maxLength`, `gradient` and `lineHeight`, added more end-to-end tests |
478 | 514 | | * 2.6.0 - added transition gradients and sets |
| skipped 50 lines |