Giter Club home page Giter Club logo

console.ascii's Introduction

console.ascii()

Build Status

Let's extend browser's console by adding some funny ascii art! Run the console.ascii() and see the magic happens! ๐Ÿ’ฅ

See the demo.

Installation

npm install

npm run build -> Building JS to /dist folder.

npm run test -> Running tests.

Usage

console.ascii('search term', {settings});

Console searches openclipart.org by default althought the support of Google Images and Flickr is implemented.

The result can be colorful or plain ascii art.

Settings

setting type default description possible values
source string clipart Choose the source of images where to search - whether openclipart.org, google.com or flickr.com clipart / google / flickr
color bool true Show colorful ASCII art?
debug bool false Show debug information?
verbose bool false Show messages when executing Promises?
width int 120 Scaling result image ~ number of characters on line.
chars array ['@','#','$','=','*','!',';',':','~','-',',','.',' '] Characters to use for "drawing". From darker โžก brighter.
sourceSettings object {} Additional settings for search sources (Google, Flickr)
callback function null Callback to call after output.

Sources

Google Images

To be able to use Google Images as a search source, you need to setup Google Custom Search and configure the console.ascii.

List of possible parameters are here, defaults are:

key value
searchType image
cx ''
imgSize medium
imgType lineart
imgDominantColor white
imgColorType color
key ''

Example

console.ascii('car', {color: false, source: 'google', sourceSettings: {key: 'YOUR_KEY_GOES_HERE', cx: 'YOUR_CX_ID_GOES_HERE', imgType: 'photo', imgColorType: 'color', safe: 'high'}});

Warning โš ๏ธ

Some images especially from Google Images may be block due to same origin policy as Google returns links from origin source ๐Ÿ‘Š. The only workaround is to use custom proxy.

Flickr

There's only one default parameter api_key, but you can add more parameters based on this list.

Flickr support CORS ๐Ÿ‘๐Ÿป so all images coming from Flickr should be accessible without any issue.

Openclipart.org

This is default search source. There's no special settings.

Openclipart.org supports CORS too ๐Ÿ‘๐Ÿป.

Examples

console.ascii('fishing rod', {color: false, debug: true});

console.ascii('rabbit', {source: 'flickr', sourceSettings: {api_key: 'YOUR_API_GOES_HERE'}, width: 60, color: true});

console.ascii('rabbit', {source: 'flickr', sourceSettings: {api_key: 'YOUR_API_GOES_HERE'}, width: 60, color: true});

console.ascii('funny airplane', {verbose: true, width: 50, color: true});

console.ascii('car', {color: false, source: 'google', sourceSettings: {key: 'YOUR_KEY_GOES_HERE', cx: 'YOUR_CX_ID_GOES_HERE'}});

Why?

Why not!?

Gallery

console.ascii's People

Contributors

lucien144 avatar

Watchers

 avatar  avatar

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.