Skip to main content

WaveDrom generates diagrams for digital waveforms, bit fields, and simple combinational circuits

Project description

YoWASP WaveDrom package

This package provides a self-contained WaveDrom renderer for JavaScript and Python applications. See the overview of the YoWASP project for details.

Command-line tool

This package installs a command-line tool yowasp-wavedrom.

Usage: yowasp-wavedrom [<input.json>] [<output.svg>]

API reference (JavaScript)

The @yowasp/wavedrom package has one entry point, render(source): string. It accepts a JavaScript object in the WaveJSON format and returns an SVG image serialized as a string:

import { render } from '@yowasp/wavedrom';

console.log(render({signal: [{ name: "clk", wave: "p..." }, { name: "data", wave: "01.0" }]}));
// => <svg.../svg>

API reference (Python)

The yowasp-wavedrom package has one entry point, render(source) -> str. It accepts a Python dictionary in the WaveJSON format and returns an SVG image serialized as a string:

from yowasp_wavedrom import render

print(render({"signal": [{ "name": "clk", "wave": "p..." }, { "name": "data", "wave": "01.0" }]}))
# => <svg.../svg>

Implementation notes

This package embeds the upstream WaveDrom library bundled with the minimal amount of dependencies necessary to produce a serialized SVG, and, for the Python package, with a JavaScript runtime. In addition, the output is post-processed compared to the upstream library as follows:

  • The id attribute of the root <svg> element is removed.
  • The stylesheets are altered to take into account dark color scheme preference via media queries. If the user agent reports dark color scheme preference, the colors in the diagram are inverted.
    • In case of the dark waveform diagram skin, this will cause it to use light colors.
    • When the SVG image is embedded in an HTML document using the <img> tag, the color scheme preference can be set per-image using a CSS rule such as img { color-scheme: light; }. This can be used to make the images responsive to dynamic theming, or simply to override the default behavior.
  • Several otherwise blocking bugs are worked around.

Updates

Unlike most YoWASP packages, this package does not automatically track upstream releases. Please open a pull request bumping the version of wavedrom in package-in.json if you need a feature from a newer version of WaveDrom.

License

This package is covered by the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

yowasp_wavedrom-3.5.0.8-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file yowasp_wavedrom-3.5.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for yowasp_wavedrom-3.5.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f5e6250e42dc7a93648b196e121ddeb72965f70620a18579ade2e9723cc5a65e
MD5 c2e03c6324350bbbfc98c00d93bee8e1
BLAKE2b-256 ae61f4ded74b2e1e1757288f46ea6c3649281493fac98c8ec52e6999914bf141

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page