vsketch icon indicating copy to clipboard operation
vsketch copied to clipboard

Set line color

Open roblourens opened this issue 4 years ago • 14 comments

It would be great if I could customize the stroke color. Otherwise it's hard to use this with Jupyter in dark mode, or vscode notebooks, which use a dark theme by default.

image

I see color_mode but that doesn't quite do what I need.

roblourens avatar Jan 02 '21 17:01 roblourens

Thanks for your feedback. This is indeed on the roadmap, although I haven't yet figured out the details on how/when it'll happen.

Related to abey79/vpype#35

abey79 avatar Jan 08 '21 15:01 abey79

I'm also interested in this. Reading through abey79/vpype#35, it seems like this might be a viable approach?

  • Add color property to LineCollection
  • Add support for color property to viewer and write_svg
  • Add a command to set the color for a layer

The design required for the linked issue looks complicated, so I'm hoping that implementing just this piece would be easier. If this is the right approach, or there is another approach that skirts the broader design questions, I'm happy to take a stab at it and submit a pull request.

ademuri avatar Feb 20 '21 04:02 ademuri

@ademuri @roblourens Do you consider important that the SVG background be black? One quick workaround would be to set the SVG background to white, until proper support comes via abey79/vpype#35.

Side question: do you see yourselves sticking to the jupyter environment now that I added vsk?

abey79 avatar Feb 20 '21 17:02 abey79

My use case is different than OP's. I use vsk. I would like to be able to set colors (and background) because I'm doing white-on-black and multi-color plotting, and want preview and export SVG to match the colors I'll use.

ademuri avatar Feb 20 '21 20:02 ademuri

If I understand correctly, abey79/vpype#213 would then partially cover your use case, except:

  1. export SVG would not have the correct colour (just the viewer)
  2. for vsketch, the "selected theme" would need to be remembered on a sketch by sketch basis instead of globally (no big deal to implement)

How important having the right colours in the SVG is, compared to having the ability to preview correct colours in the viewer?

abey79 avatar Feb 21 '21 08:02 abey79

Yep, that'd be nice to have. Previewing the correct colors in the viewer is more important - I can always manually change the colors in the SVG.

ademuri avatar Feb 21 '21 16:02 ademuri

Just curious: what is the reason SVG colours are important to you (assuming its used as plotting file)?

abey79 avatar Feb 21 '21 18:02 abey79

Just because it would be a better experience to work with a preview in Jupyter Lab (or a jupyter notebook in vscode) when a dark theme is used.

roblourens avatar Feb 21 '21 19:02 roblourens

@roblourens of course for Jupyter it makes sense. Do you plan on sticking to Jupyter or move to vsk?

abey79 avatar Feb 21 '21 19:02 abey79

I have an ulterior motive which is that I am on the vscode team working on notebooks, and I wanted to use that environment for sketches 😁

roblourens avatar Feb 21 '21 20:02 roblourens

Fair enough 😃

abey79 avatar Feb 21 '21 20:02 abey79

Yes, I use the SVGs as plotting files. I want to specify the colors so when I e.g. share on PlotterFiles it matches my "creative vision".

ademuri avatar Feb 21 '21 22:02 ademuri

+1. My use case is displaying the plot simulation on screen for a client before plotting -- "why is it blue?". For now I'm simply opening the SVG and replacing "#00f" with "#000", e.g. sed -i 's/#00f/#000/g' plot.svg

eth0izzle avatar Apr 23 '21 23:04 eth0izzle

eth0izzle has got it. The fill also can be controlled from none to a color: sed -i 's/none/#fff000/g' plot.svg

JupyterJones avatar Nov 02 '22 14:11 JupyterJones