All Projects → calinalexandru → chord-illustrator-js

calinalexandru / chord-illustrator-js

Licence: MIT license
SVG-based library, which illustrates finger positions of a guitar chord on a fretboard.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to chord-illustrator-js

Chord-Draw
Draw guitar chord diagrams for all variations of any chord and also display finger positions etc.
Stars: ✭ 17 (+0%)
Mutual labels:  guitar, chord
CliChords
[CliChords] Get ultimate-guitar.com guitar tabs and chords in your terminal - command line cli
Stars: ✭ 20 (+17.65%)
Mutual labels:  guitar
ai-scripts
Scripts for Adobe Illustrator.
Stars: ✭ 18 (+5.88%)
Mutual labels:  illustrator
SwiftyIllustrator
A tool for quickly converting Adobe Illustrator shapes into SwiftUI code.
Stars: ✭ 26 (+52.94%)
Mutual labels:  illustrator
hangman-game
A responsive hangman game built with vanilla javascript, html, and css. Animated with GSAP and canvas animations.
Stars: ✭ 22 (+29.41%)
Mutual labels:  illustrator
brand
Logos, icons, screenshots, and other media related to the Bitwarden brand.
Stars: ✭ 60 (+252.94%)
Mutual labels:  illustrator
illustrator-point-exporter
✨ JSON exporter for Adobe Illustrator: get point coordinates from paths by layer.
Stars: ✭ 72 (+323.53%)
Mutual labels:  illustrator
arpeggio
A chord naming app for guitar written in React.
Stars: ✭ 49 (+188.24%)
Mutual labels:  guitar
GuitarHeroUnity
Open Source - Guitar Hero fan game made in Unity
Stars: ✭ 100 (+488.24%)
Mutual labels:  guitar
Apssistant
A Photoshop Tweak Tool on Windows. It can disable ALT to activate the menu bar.
Stars: ✭ 48 (+182.35%)
Mutual labels:  illustrator
NS-illustration-pack
Package of 3D low poly illustrations created in a Blender
Stars: ✭ 28 (+64.71%)
Mutual labels:  illustrator
illustrator-scripts
Set of scripts to improve Icons workflow
Stars: ✭ 26 (+52.94%)
Mutual labels:  illustrator
brutalism
Battleaxe's component library for Adobe CEP panels
Stars: ✭ 43 (+152.94%)
Mutual labels:  illustrator
ovid-editor
Adobe panel providing the most advanced scripting environment possible -- Typescript, app DOM autocomplete, full I/O features and more
Stars: ✭ 43 (+152.94%)
Mutual labels:  illustrator
illustrator-shortcuts
collection of scripts and shortcuts for illustrator
Stars: ✭ 38 (+123.53%)
Mutual labels:  illustrator
adobe-discord-rpc
Discord Rich Presence extension for your adobe apps!
Stars: ✭ 383 (+2152.94%)
Mutual labels:  illustrator
ai-scripts
A collection of useful Illustrator scripts
Stars: ✭ 37 (+117.65%)
Mutual labels:  illustrator
ai-image-fill
Simple Adobe Illustrator Panel to generate placeholder image content from Flickr or Unsplash
Stars: ✭ 30 (+76.47%)
Mutual labels:  illustrator
phptabs
A PHP library for reading, writing and rendering guitar tablatures and MIDI files
Stars: ✭ 34 (+100%)
Mutual labels:  guitar
adobe-illustrator-layer-renamer
Adobe Illustrator script to batch rename layers.
Stars: ✭ 40 (+135.29%)
Mutual labels:  illustrator

chord-illustrator NPM version

SVG-based library, which illustrates finger positions of a guitar chord on a fretboard.

  • Blazingly fast and blazingly small 🚀
  • No dependencies
  • Works on browser & Node.js
  • Minified: 2.4 kB
  • Minified + gzipped: 1 kB

Installation

$ npm install --save chord-illustrator

Usage in browser

illustrates B minor

import ChordIllustrator from 'chord-illustrator';

// insert it into any HTML element
ChordIllustrator.setContainer(document.body);

// or get output directly
const svg = ChordIllustrator.make({
  name: 'Bm',
  mutedStrings: ['yes'],
  fingering: [
    { fret: 2, barre: { from: 1, to: 5 } },
    { fret: 3, string: 2, finger: 2 },
    { fret: 4, string: 3, finger: 4 },
    { fret: 4, string: 4, finger: 3 },
  ],
});
console.log('HTML output', svg);

looks like this

sometext

the fretboard will expand automatically based on chord length

Usage in Node.js

The library is tightly coupled with window.document. To use it on Node.js, you may want to import something like jsdom.

import { JSDOM } from 'jsdom';
import ChordIllustrator from 'chord-illustrator';

// create some html
const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);

// set missing dom
ChordIllustrator.setDocument(dom.window.document);

const svg = ChordIllustrator.make({
  name: 'C',
  mutedStrings: ['yes'],
  fingering: [
    { fret: 1, string: 2, finger: 1 },
    { fret: 2, string: 4, finger: 2 },
    { fret: 3, string: 5, finger: 3 },
  ],
});
console.log('HTML output', svg);

API docs

.setContainer(container: HTMLElement)

  • set the container where the output renders.

.setDocument(document: DOM)

  • override the default window.document with your own.

.setHeight(height: number)

  • specify the SVG height. The width will adjust automatically.

.make({ name: string, fingering: array, mutedStrings: array, fretboardRange: object, labels: object })

  • specify the chord options by passing an object. Only fingering property is mandatory, and others are optional.
@param(name: string)

The title is displayed at the top. Omit the property to hide.

name: 'Am';
@param(fingering: array)

Mandatory property detailing the chord fingering:

fingering: [
  { fret: 2, barre: { from: 1, to: 5 } },
  { fret: 3, string: 2, finger: 2 },
];
@param(mutedStrings: array)

An array of 6 items filled with ”yes/no/open”. If not specified, values will default to “no”.

mutedStrings: ['yes', 'no', 'no', 'no', 'no', 'open'];
@param(fretboardRange: object)

The fretboard will expand automatically based on chord length. You may override the generated fretboard like this:

fretboardRange: { from: 1, to: 12 }
@param(labels: object)

The fret number label is shown at the bottom left. You can hide this label or customize the prefix:

labels: {
  title: { style: { show: false, fill: 'blue', opacity: 1 } },
  fretNumber: { style: { show: false, fill: 'red', opacity: 1 } },
}

You can customize the whole SVG fretboard using this object.

fretboard: {
  fret: { style: { stroke: 'red', fill: 'red' } },
  string: { style: { stroke: 'green', fill: 'green' } },
  neck: { style: { stroke: 'blue', fill: 'blue' } },
  barre: { style: { stroke: 'gray', fill: 'gray' } },
  finger: { style: { stroke: 'yellow', fill: 'yellow' } },
  fingerText: { style: { stroke: 'orange', fill: 'orange' } },
}
@param(vertical: boolean)

Display the chord vertically.

vertical: true,

Support

Tested on Chrome & Node.js v17.6.0

License

MIT © Alexandru Calin

inspired by guitar-js (Fomin Sergey)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].