jgraph / drawio

draw.io is a JavaScript, client-side editor for general diagramming.
https://www.drawio.com
Apache License 2.0
40.36k stars 7.54k forks source link

Modify svg color directly #2473

Closed OhYee closed 2 years ago

OhYee commented 2 years ago

Is your feature request related to a problem? Please describe. I often insert svg inside the image, but most of the svg colors are set directly in the path using fill. Drawio only supports setting the color using style, so I need to modify the svg source code to change the color every time.

Describe the solution you'd like I want drawio can directly modify each fill of path

Describe alternatives you've considered none

Additional context none

alderg commented 2 years ago

See https://www.diagrams.net/doc/faq/svg-edit-colours

OhYee commented 2 years ago

@alderg I have read and using the features in the documentation, but it doesn't meet my needs

Maybe the issue needs to be reviewed and reopen it

alderg commented 2 years ago

We are are not an SVG editor. Please explain why those features cannot be used in your case.

OhYee commented 2 years ago

Most of the svg images I've seen don't use style to control color, but rather use fill to control color directly. This leads to a scenario where the editableCssRules supported by drawio are barely used, and if the edit fill field could be supported, it would easier when using svg.

Maybe drawio doesn't need to support complex svg editing, just show and modify all the fill fields

alderg commented 2 years ago

Modify the SVG and replace the fill with a style as shown in the documentation.

OhYee commented 2 years ago

It only support fill in style like <style>.f1{fill: #000}</style>. Doesn't support <path d="..." fill="#000"/>.

alderg commented 2 years ago

<path class="f1"...

OhYee commented 2 years ago

Yes, I can make drawio color editable by modifying the svg, which is what I do now. But since most svg don't use style to set colors, I need to modify almost all svg.

It would be better to have direct support for editing the fill inside the path

SmiVan commented 10 months ago

This is a fairly big inconvenience, it would be more user-friendly to just have a general color override option for fill and/or stroke when an SVG is dragged in by default.

It's unreasonable to expect an average user to have to manually edit every single SVG and shape style with an obscure parameter just to suit the requirements of drawio.

Or perhaps the style element and class tags could be injected automatically when an SVG is dropped in, if it's too difficult to implement an override?

davidjgraph commented 10 months ago

No, draw.io isn't an SVG editor, this is written in the readme. Saying I use your tool therefore you need to meet every use case isn't how it works. We set the scope of the project, if you don't like it, find another tool.

SmiVan commented 10 months ago

This doesn't request anything that would turn draw.io into an SVG editor, changing colors of elements is already standard functionality in draw.io - it's just that here it's implemented in an inconsistent manner that requires manual tweaking to use.