Skip to content

In vscode notebook environment score svgs is displayed washed out.  #10

Description

@kkibria

Using following in vscode with a .ipynb file,

%load_ext abjadext.ipython
import abjad
staff = abjad.Staff("c'4 d'4 e'4 f'4")
abjad.show(staff)

the score looks washed out and hard to see.

So I had to write a stop-gap ipython extension containing following. This simply wraps the svg in a div and displays as html. This way the vscode notebook styling is propagated thru currentColor and it looks fine.

from abjad.io import Illustrator
from abjadext import ipython as ip

def load_ipython_extension(ipython):
    # override abjads show()
    ip.load_ipython_extension(ipython)
    Illustrator.open_output_path = render_svg

def render_svg(self, svgpath):
    from IPython.core.display import display_html
    with svgpath.open() as f:
        svg = f.read()
    display_html("<div>"+svg+"</div", raw=True)

I am proposing to incorporate this scheme in your extension directly, Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions