Skip to content

shkuznetsov/chord-diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chord diagram generator in pure JS

A tiny (~750 bytes when minified and gzipped) function written in pure javascript (no jQuery or other dependencies) which draws basic guitar chord diagrams in HTML/CSS. Accepts an array of fret positions (mandatory) and an array of finger numbers (optional). Automatically detects barre if more than one string is picked on the same fret with the same finger.

Quick start

Download a JS file (minified, gzipped) and a CSS stylesheet (minified, gzipped), drop them onto your page. To create a div containing DOM structure for C chord call:

var diagram = chordDiagram([-1,3,2,0,1,0], [-1,3,2,-1,1,-1]);

Then to attach it to your document, call:

document.body.appendChild(diagram);

Above will produce something like this:

C chord diagram goes here

Arguments

You sort of can work it out from the above example, but I will describe it here at some point.

Copyright and license

Doesn't apply. Use it as you wish, but be aware that it may explode and blow your head off or something, so don't come back to me if that happens blah blah blah.

About

Chord diagram generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published