# chordproject-diagrammer

> A TypeScript library for generating SVG chord diagrams.

Latest version **0.1.8** (published 2021-04-14) · 0 weekly downloads

## Install

```sh
npm install chordproject-diagrammer
pnpm add chordproject-diagrammer
yarn add chordproject-diagrammer
bun add chordproject-diagrammer
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2021-04-14 |
| First published | 2021-03-07 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=4.2.4 |
| Dependencies | 0 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jaime Mora |
| Maintainers | jrmora |
| Keywords | chordpro, chordproject, viewer, chord, diagrams |

## Links

- npm: https://www.npmjs.com/package/chordproject-diagrammer
- npm.io page: https://npm.io/package/chordproject-diagrammer

## Recent versions

- 0.1.8 (latest) — 2021-04-14
- 0.1.7 — 2021-04-12
- 0.1.6 — 2021-04-12
- 0.1.5 — 2021-04-12
- 0.1.4 — 2021-03-17
- 0.1.3 — 2021-03-09
- 0.1.2 — 2021-03-09
- 0.1.1 — 2021-03-08
- 0.1.0 — 2021-03-07

## README

# ChordProject Diagrammer

A TypeScript frontend library for generating SVG chord diagrams from JSON specification.

Inspired by: https://github.com/tombatossals/react-chords.

## Overview

Generates SVG chord diagrams according to received specification.

![Diagrams](./diagrammer.png)

## Usage

It's really easy to draw an SVG chord diagram:

```ts
// chord diagram definitions
const chordDiagram = new ChordDiagram({
    frets: [-1, 0, 2, 2, 1, 0],
    fingers: [0, 0, 2, 3, 1, 0],
    baseFret: 1,
});

// instrument definitions
const instrument = {
    strings: 6,
    fretsOnChord: 4,
    name: "Guitar",
    tunings: ["E", "A", "D", "G", "B", "E"],
};

const generator = new Diagrammer(); // create an instance of Diagrammer
var svg = generator.builder(chordDiagram, instrument); // build the svg
document.body.appendChild(svg); // add the svg in the html content (here the body)
```

A ChordDiagram is defined by:

-   frets (array of numbers). Use 0 for open strings and -1 for muted strings. Frets must be relative to the base-fret.
-   fingers (array of numbers). Use 0 for no finger. The fingers array length must match the frets array length. The fingers are optional
-   base-fret (number)

You can customize the diagram by passing a Settings object in the Diagrammer constructor.
All of the settings has already a default value.

#### Part of [ChordProject](https://chordproject.com/)

---
_Source: https://npm.io/package/chordproject-diagrammer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
