Coder Social home page Coder Social logo

dominikwilkowski / cfonts Goto Github PK

View Code? Open in Web Editor NEW
1.5K 17.0 59.0 6.96 MB

Sexy fonts for the console

Home Page: https://www.npmjs.com/package/cfonts

License: GNU General Public License v3.0

JavaScript 22.79% HTML 20.15% Makefile 0.01% Rust 57.04%
cli font nodejs chalk ansi ascii ascii-art shell generator sexy-fonts sexy

cfonts's Issues

throws 'userColors[color].toLowerCase() is not a function'

If my program contains custom properties for Array, then CheckInput() throws a "TypeError: userColors[color].toLowerCase() is not a function" error. This is because for (var color in userColors) iterates over both the array elements and the custom properties. I believe changing for...in to for...of will fix it. To reproduce:

Array.prototype.foo = () => { return 0; };
const cfonts = require('cfonts');
cfonts.say('Hello', { colors: [ 'green' ] });

Throws when run non-interactively

When this module is used in a process that runs non-interactively (non-TTY, for example, when it's a child process), it throws:

TypeError {
    message: 'Cannot read property \'width\' of undefined',
  }

  Object.render (node_modules/cfonts/index.js:464:121)

I would suggest using term-size instead of window-size, as it works even when non-TTY. Alternatively, you could fall back to a width of 80.

Brew: No available formula

brew install cfonts

Warning: No available formula with the name "cfonts". Did you mean conftest?
==> Searching for similarly named formulae...
This similarly named formula was found:
conftest
To install it, run:
  brew install conftest
==> Searching for a previously deleted formula (in the last
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

Classic ASCII Art Banner

Hi,

do you have an example for the classic ASCII art banner that draws my String with lines in Rust?

error: unknown option `-t'

$ npm install -g cfonts
/home/chaz/.local/bin/cfonts -> /home/chaz/.local/lib/node_modules/cfonts/bin/font.js
/home/chaz/.local/lib
└── [email protected]

$ which cfonts
~/.local/bin/cfonts

$ cfonts

 Ouch: Please provide text to convert with cfonts -t "Text"
       Run cfonts --help for more infos

$ cfonts -t "Text"

  error: unknown option `-t'

If I can provide any more useful information please let me know.

Can cfonts be webpacked?

When I build my project with webpack,then run the .js file, I got error:

Error: ENOENT: no such file or directory, open '/package.json'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)

Can webpack cfonts into one file? Thanks.

About license of porting library

As you may know, I am maintaining a Python port of cfonts.

At beginning, I just translate node js code to Python, but after the major refactor, I write my own code to implement new features. I would like to know if I can apply a different license other than GPL2.0, say, MIT?

Should be possible to not have a background color

screen shot 2018-04-07 at 17 44 54

This is how it looks in my terminal by default. Pretty ugly, since the default black background doesn't match my terminal background. I think the default should be no background color, but I would be happy with having a 'none' option too.

center text

could you add an option to center text horizontally?

Is there any way to use this in python?

Sorry if this is a dumb question, but is there any way to use this in python? I can't just copy paste, it completely breaks. I know there's a version of this made in python, called python-cfonts, by frostming, but the gradients don't look good. I know the console supports more colors, but is there a way to use it in python? TIA!

New lines with \n instead of |

When using CFonts.say() I think it would be nice to be able to add a new line. An example of this might be:

CFonts.say( `Please some stuff \n Some stuff on a new line`, {
  font:  'console',
  align: 'center',
  colors: [ 'white' ],
});

I understand that you can do:

CFonts.say( `Please some stuff | Some stuff on a new line`, {
  font:  'console',
  align: 'center',
  colors: [ 'white' ],
});

Happy for this to be closed if it's not possible. I just thought it would be nice to mimic default console.log behaviour in this instance.

color detection not working as intended?

If I set TERM=xterm-256color or TERM=xterm, I don't get a smooth gradient transition, but it works if I set FORCE_COLOR=3.

Does this mean color detection is not working as intended?

Panic with gradient and font "console"

To reproduce:

$ cfonts "$(seq 200)" -f console -g red,magenta
thread 'main' panicked at src/gradient.rs:443:32:
range end index 3 out of range for slice of length 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This bug depends on the width of the terminal and the length of the text.
If you can't reproduce the panic, try it in a narrower window or increase the seq argument.

Multiple different fonts on the same line

First of all, thanks for this awesome piece of code !
I could not see a previous question related to that, hence, here it is:
Is it possible:

  • to specify multiple values at the same time with cfonts
  • each value would have different option style
  • and have them displayed on the same line ?

For example:

cfonts "hello" -f "simple3d" -c "red" "world" -f "3d" -c "green"

I'm using rust crate but this can be applicable to all cfonts flavor ?
(I tried multiple tests with render but did not succeed on reaching the result described above )

d.ts

可以提供typescript d.ts 类型声明吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.