npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asciiart-logo

v0.2.7

Published

Splashscreen in text console with logo from ASCII characters

Downloads

3,689

Readme

ASCII-art Logo

asciiart-logo renders a splash screen in text console with logo from ASCII characters.

Splash screen is a rectangular panel and logo is the application name rendered by ASCII-art fonts extended by optional additional information (author, application version, short desctiption, etc). Example console output from this project's package.json:

,-------------------------------------------------------------------.
|                                                                   |
|       _             _ _            _     _                        |
|      / \   ___  ___(_|_) __ _ _ __| |_  | |    ___   __ _  ___    |
|     / _ \ / __|/ __| | |/ _` | '__| __| | |   / _ \ / _` |/ _ \   |
|    / ___ \\__ \ (__| | | (_| | |  | |_  | |__| (_) | (_| | (_) |  |
|   /_/   \_\___/\___|_|_|\__,_|_|   \__| |_____\___/ \__, |\___/   |
|                                                     |___/         |
|                                                                   |
|                                                    version 0.2.3  |
|                                                                   |
|  Splashscreen with logo from ASCII characters in text console.    |
|                                                                   |
`-------------------------------------------------------------------'

asciiart-logo can be used by starting of command line tools, web servers or REST API microservices as a visual feedback to the user or administrator about successful start of the application.

Quick Start

  1. Download and install with command npm install asciiart-logo
  2. See in action with command node example.js

Simple Usage: Default Splash Screen

Simplest usage is to provide the package.json file and call the method render to write out the splash screen to console:

const logo = require('asciiart-logo');
const config = require('./package.json');
console.log(logo(config).render());

The asciiart-logo will render following information from the package.json:

  • name - rendered with ASCII-art font to dominate the splash screen
  • version - right-alligned so it will not "fight" for reader's attention
  • description - short information about the project

## Rich Usage: Explicit Parametrization

The main impression of the splash screen is shaped by the selection of the right ASCII-art font.

Number of characters of the logo in single line (parameter lineChars) controls word wrapping logic in logo rendering and indirectly the width of the panel.

You can adjust also padding and margin of the panel.

  • name - applicaiton name in ascii-art logo (name parameter in project.json defines name of the application)
  • font - ASCII-art font from the font gallery - default font is Standard
  • lineChars - length of line in name (ascii-art logo) for word wrapping
  • padding - space around the panel around text (like in CSS) - default is 5
  • margin - left space outside of the panel - default is 2

Text functions

The text in splash screen is wrapped according the size of logo. Spaces, new lines, tabs are squeezed into single space. Text can be programmatically writen with functions:

  • left - text is alligned to left or wrapped
  • right - text is alligned to right or wrapped
  • center - text is alligned to center or wrapped
  • wrap - synonym to function left
  • emptyLine - add empty line into the panel

Method render() must be the last one to call - it writes out the splash screen to console.

Color

Default usage prints the splash screen with default color. Splash screen can be colored by parameters:

  • logoColor
  • textColor
  • borderColor

Color can have following values:

  • black, red, green, blue, yellow, magenta, cyan, white
  • bold-black, bold-red, bold-green, bold-blue, bold-yellow, bold-magenta, bold-cyan, bold-white

Example with parametrization and text functions

const longText = 'Lorem ipsum dolor sit amet, ' +
    'consectetur adipiscing elit, ' +
    'sed do eiusmod tempor incididunt ut labore et ' +
    'dolore magna aliqua. Ut enim ad minim veniam, ' +
    'quis nostrud exercitation ullamco laboris ' +
    'nisi ut aliquip ex ea commodo consequat. Duis aute ' +
    'irure dolor in reprehenderit in voluptate velit esse ' +
    'cillum dolore eu fugiat nulla pariatur. ' +
    'Excepteur sint occaecat cupidatat non proident, ' +
    'sunt in culpa qui officia deserunt mollit anim ' +
    'id est laborum.';

console.log(
    logo({
        name: 'Just a simple example',
        font: 'Speed',
        lineChars: 10,
        padding: 2,
        margin: 3,
        borderColor: 'grey',
        logoColor: 'bold-green',
        textColor: 'green',
    })
    .emptyLine()
    .right('version 3.7.123')
    .emptyLine()
    .center(longText)
    .render()
);

... and the output on the console:


   ,---------------------------------------------------------.
   |                                                         |
   |  _________             _____                            |
   |  ______  /___  __________  /_   ______ _                |
   |  ___ _  /_  / / /_  ___/  __/   _  __ `/                |
   |  / /_/ / / /_/ /_(__  )/ /_     / /_/ /                 |
   |  \____/  \__,_/ /____/ \__/     \__,_/                  |
   |                                                         |
   |  ____________                   ______                  |
   |  __  ___/__(_)______ ______________  /____              |
   |  _____ \__  /__  __ `__ \__  __ \_  /_  _ \             |
   |  ____/ /_  / _  / / / / /_  /_/ /  / /  __/             |
   |  /____/ /_/  /_/ /_/ /_/_  .___//_/  \___/              |
   |                         /_/                             |
   |  __________                                ______       |
   |  ___  ____/___  _______ _______ ______________  /____   |
   |  __  __/  __  |/_/  __ `/_  __ `__ \__  __ \_  /_  _ \  |
   |  _  /___  __>  < / /_/ /_  / / / / /_  /_/ /  / /  __/  |
   |  /_____/  /_/|_| \__,_/ /_/ /_/ /_/_  .___//_/  \___/   |
   |                                    /_/                  |
   |                                                         |
   |                                        version 3.7.123  |
   |                                                         |
   |   Lorem ipsum dolor sit amet, consectetur adipiscing    |
   |   elit, sed do eiusmod tempor incididunt ut labore et   |
   |   dolore magna aliqua. Ut enim ad minim veniam, quis    |
   |  nostrud exercitation ullamco laboris nisi ut aliquip   |
   |    ex ea commodo consequat. Duis aute irure dolor in    |
   |   reprehenderit in voluptate velit esse cillum dolore   |
   |    eu fugiat nulla pariatur. Excepteur sint occaecat    |
   |    cupidatat non proident, sunt in culpa qui officia    |
   |          deserunt mollit anim id est laborum.           |
   |                                                         |
   `---------------------------------------------------------'

Credits

The asciiart-logo uses following awsome libraries:

  • ASCII-art font Font rendering: fiddler
  • Color: chalk
  • Text in title case: to-title-case