Skip to main content

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.

Release files for yowasp-wavedrom 3.5.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for yowasp-wavedrom 3.5.0.9
File Interpreter ABI Platform
yowasp_wavedrom-3.5.0.9-py3-none-any.whl Python 3 none any Details

Release files / yowasp_wavedrom-3.5.0.9-py3-none-any.whl

Download URL yowasp_wavedrom-3.5.0.9-py3-none-any.whl
Size 40.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ecd53fd48dfc5fc5c49c47dcbcf43258864084177a1fb870a5ced1f8fedbab5
BLAKE2b-256 checksum
How to use checksums
9d4138990239e079c0fd84a9757353737188c3be9fb539be3ce5eef2efab3e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

3.5.0.9 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page