Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Style #548

Open
calumk opened this issue Feb 26, 2024 · 7 comments
Open

CSS Style #548

calumk opened this issue Feb 26, 2024 · 7 comments
Labels
not planned; PR anyone? Not planned for the near future, but not rejected yet either proposal

Comments

@calumk
Copy link

calumk commented Feb 26, 2024

When editing lots of svgs in say, an icon pack or similar, it is usefull to be able to use a style sheet and classes - to have consistancy across multiple files.

Can GodSVG allow css classes, and provide a box where css can be written / pasted

@MewPurPur
Copy link
Owner

It's not in my near-future plans to consider SVGs that aren't standalone.

@calumk
Copy link
Author

calumk commented Feb 26, 2024

I get where your coming from, but it's just using an SVG that has classes, which is pretty normal practice

https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/SVG_and_CSS

BoxySVG also doesn't support this, which is why I was really hoping godsvg would - it's almost perfect for my use case otherwise

@MewPurPur MewPurPur added the not planned; PR anyone? Not planned for the near future, but not rejected yet either label Feb 27, 2024
@MewPurPur
Copy link
Owner

It might become prioritized sooner if you can help us work out implementation details.

@MewPurPur
Copy link
Owner

MewPurPur commented Mar 12, 2024

Now that the Settings menu has been reworked, this might be able to land somewhere in there. But the above comment still stands, it's not planned but I might get to it sooner if we can work out implementation details.

@calumk
Copy link
Author

calumk commented Mar 12, 2024

Great to know

@MewPurPur
Copy link
Owner

MewPurPur commented Mar 24, 2024

Is what you need effectively solved by adding

<defs>
    <style><![CDATA[
       {YOUR CSS CONTENT HERE}
    ]]></style>
  </defs>

right after the SVG declaration in a standalone SVG?

Please don't test this in GodSVG, it can't handle text or CDATA right now.

@calumk
Copy link
Author

calumk commented Mar 24, 2024

That would correctly render yes.
I would be able to manually seperate the css and svg data - eg

Again, appreciate my use case is fairly specific

<g class="whiff_component">
    <g id="Compressor">
        <g id="Symbol">
            <path class="whiff_st0" d="M7.5 2.44v-2" />
            <path class="whiff_st0" d="M7.5 2.44L.41 14.6h14.18z" />
        </g>
        <g id="Connectors">
            <path data-tag="whiff_port" data-port="p" class="whiff_st1" d="M6,0H9v2.4H6V0z"/>
        </g>
        <g id="Bounding">
            <rect width="15" height="15" class="whiff_bounding"/>
        </g>
    </g>
</g>
 .whiff_st0 {
  fill: #fff;
  fill-opacity: 0.5;
  stroke: #000;
  stroke-width: 0.7087;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-miterlimit: 10;
}
.whiff_st1 {
  opacity: 0.3;
  fill: #f40c0c;
  enable-background: new;
}
.whiff_st2 {
  opacity: 0.3;
  fill: limegreen;
  enable-background: new;
}
.whiff_bounding {
  opacity: 0;
  fill: lightblue;
  stroke: none;
  pointer-events: none;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not planned; PR anyone? Not planned for the near future, but not rejected yet either proposal
Projects
None yet
Development

No branches or pull requests

2 participants