dwave-theme is a centralized theme and configuration package for creating
unified, D-Wave-branded user interfaces and visualizations across D-Wave
projects. It provides:
- A central repository of D-Wave brand color palettes (qualitative, sequential) with light and dark variants.
- Ready-to-use matplotlib style presets, such as
default,dark, andpresentation-light, as well as composable style components (base layout, typography, themes, and palettes) for building custom looks.
import matplotlib.pyplot as plt
import dwave.theme.matplotlib as dwave_theme
# List all available presets and components
dwave_theme.available_styles()
# Apply the standard D-Wave look globally
dwave_theme.set_theme()
# Or apply the dark preset
dwave_theme.set_theme("dark")
# Temporarily switch styles for a specific figure
with dwave_theme.context("presentation-light"):
plt.plot([1, 2, 3])
plt.savefig("slide.png")
# Preview the available color palettes
dwave_theme.show_palettes()Installation from PyPI:
pip install dwave-themeDuring package development, it is often convenient to use an editable install:
pip install --editable .All code should be thoroughly tested and all pull requests should include tests.
To run the tests, first install the package using an editable install as described above, along with the test dependencies:
pip install --group testThe tests can then be run with pytest:
pytest tests/This package follows semantic versioning: breaking changes to the public API are only introduced in major releases.
Released under the Apache License 2.0. See LICENSE file.
Ocean's contributing guide has guidelines for contributing to Ocean packages.
dwave-theme makes use of reno to manage
its release notes.
When making a contribution to dwave-theme that will affect users, create a
new release note file by running:
reno new your-short-descriptor-hereYou can then edit the file created under releasenotes/notes/. Remove any
sections not relevant to your changes. Commit the file along with your changes.
See reno's user guide for details.