wavedrom / cli

CLI for WaveDrom
https://wavedrom.com
MIT License
61 stars 12 forks source link

Color disappears in svg #24

Closed wmat closed 6 months ago

wmat commented 1 year ago

When setting svg as the format for our wavedrom diagrams using [wavedrom, ,svg], the type attribute of bitfields (which determines background color) is ignored and the bitfield backgrounds renders grey.

Here's an example: [wavedrom, ,svg] .... {reg: [ {bits: 7, name: 'opcode', type: 8, attr: ['7','AMO','AMO','AMO','AMO','AMO','AMO','AMO']}, {bits: 5, name: 'rd', type: 2, attr: ['5','dest','dest','dest','dest','dest','dest','dest']}, {bits: 3, name: 'funct3', type: 8, attr: ['3','width','width','width','width','width','width','width']}, {bits: 5, name: 'rs1', type: 4, attr: ['5','addr','addr','addr','addr','addr','addr','addr']}, {bits: 5, name: 'rs2', type: 4, attr: ['5','src','src','src','src','src','src','src']}, {bits: 1, name: 'rl', type: 8, attr: ['1']}, {bits: 1, name: 'aq', type: 8, attr: ['1']}, {bits: 6, name: 'funct5', type: 8, attr: ['5','AMOSWAP.W/D', 'AMOADD.W/D', 'AMOAND.W/D', 'AMOOR.W/D', 'AMOXOR.W/D', 'AMOMAX[U].W/D','AMOMIN[U].W/D']}, ], config: {bits: 32}} ....

Note that if I change svg to png the colored background works.

Also, if you paste the code above into https://wavedrom.com/editor.html without the [wavedrom, ,svg] line, or the two .... lines you can see how the colors should render.

drom commented 6 months ago

Hi @wmat your example in wavedrom.com/editor looks like this: image And when converted by latest wavedrom-cli and opened in browser look like: image I don't see much diference. Could you post the rendering of your output?

wmat commented 6 months ago

Sorry, I should have been more specific. HTML rendering workd great, it's when I convert to PDF using asciidoctor-pdf, I see: Screenshot from 2024-02-22 11-50-52

drom commented 6 months ago

it might be related to https://github.com/wavedrom/bitfield/issues/56 Will try bumping bitfield -> wavedrom -> wavedrom-cli and will let you know

drom commented 6 months ago

@wmat should be done in the latest wavedrom-cli v3.2.0 Please give it a try

wmat commented 6 months ago

Unfortunately 3.2.0 didn't help.

wmat commented 6 months ago

It turns out that colorization disappears due to custom theme issues: asciidoctor: DEBUG: rv32.adoc: line 54: unknown style for table block: col[s="<|^|>"|option[s="header" asciidoctor: DEBUG: f-st-ext.adoc: line 41: unknown style for table block: col[s="<|^|>"|option[s="header" asciidoctor: DEBUG: zfh.adoc: line 96: unknown style for paragraph: half-prec-flpt-to-flpt-conv asciidoctor: DEBUG: c-st-ext.adoc: line 304: unknown style for paragraph: c-sp-load-store asciidoctor: DEBUG: c-st-ext.adoc: line 342: unknown style for paragraph: c-sp-load-store-css

After fixing these 5 errors, colorization works again.