sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SVG Toolbar Icons - Gradients Missing

    Scheduled Pinned Locked Moved Developers' Forum
    21 Posts 5 Posters 5.3k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Rich O BrienR Offline
      Rich O Brien Moderator
      last edited by

      The difference I can see is how the gradient is styled in Inkscape...

      <defs
           id="defs6">
          <linearGradient
             inkscape;collect="always"
             id="linearGradient822">
            <stop
               style="stop-color;#ff00ff;stop-opacity;1;"
               offset="0"
               id="stop818" />
            <stop
               style="stop-color;#ffd2ff;stop-opacity;1"
               offset="1"
               id="stop820" />
          </linearGradient>
          <linearGradient
             inkscape;collect="always"
             xlink;href="#linearGradient822"
             id="linearGradient824"
             x1="11.999999"
             y1="23.593208"
             x2="11.999999"
             y2="0.42856112"
             gradientUnits="userSpaceOnUse" />
        </defs>
      

      as compared to Sketch...

      <defs>
              <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
                  <stop stop-color="#EAE7CA" offset="0%"></stop>
                  <stop stop-color="#8C8A7B" offset="75.9797696%"></stop>
                  <stop stop-color="#E7E4C5" offset="100%"></stop>
              </linearGradient>
          </defs>
      

      Inkscape also introduces alot of additional code into the SVG file.

      Try tweaking your gradient code to mimic the SketchUp code. Or ask someone with Sketch to save an SVG for you.

      I know that in Inkscape there are various options when saving to SVG that cleans the code somewhat. Saving for print is different than saving for web.

      Download the free D'oh Book for SketchUp 📖

      1 Reply Last reply Reply Quote 0
      • placidfuryP Offline
        placidfury
        last edited by

        Confirmed - when I edited the SVG code to look like this:

        <linearGradient x1="50%" y1="100%" x2="50%" y2="0%" id="linearGradient-1">
             <stop stop-color="#ff00ff" offset="0%"></stop>
             <stop stop-color="#ffd2ff" offset="100%"></stop>
        </linearGradient>
        

        then the gradient DID indeed show up.

        So, anyone know of an app that will put the SVG code in a format SketchUp likes?

        1 Reply Last reply Reply Quote 0
        • Rich O BrienR Offline
          Rich O Brien Moderator
          last edited by

          Sketch but it is Mac only.

          Download the free D'oh Book for SketchUp 📖

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            Have you looked at post-processing like this:
            https://jakearchibald.github.io/svgomg/

            TIG

            1 Reply Last reply Reply Quote 0
            • Rich O BrienR Offline
              Rich O Brien Moderator
              last edited by

              I pointed him to that earlier in the thread.

              InkScape adds a lot of junk into the SVG code.

              I suspect it’s the double linear gradient tags that are the problem.

              OMGSVG doesn’t clean it sufficiently.

              Still bizarre that SketchUp can’t read an SVG if the formatting is slightly different.

              Download the free D'oh Book for SketchUp 📖

              1 Reply Last reply Reply Quote 0
              • placidfuryP Offline
                placidfury
                last edited by

                Yeah, not sure what else to try. I guess I either stick with images or manually edit the SVG code so SketchUp will read it properly, for each icon. Which I have no desire to do, as I have 59 buttons as of now, so... yeah.

                1 Reply Last reply Reply Quote 0
                • placidfuryP Offline
                  placidfury
                  last edited by

                  For what it's worth, I think the problem with Inkscape is that it makes the gradient in two parts, and has the gradient units listed as "userSpaceOnUse", and I think SketchUp doesn't know what to do with that. SketchUp likes the X/Y portion to be formatted in percentages, not on-the-fly which the userSpaceOnUse implies.

                  1 Reply Last reply Reply Quote 0
                  • Dan RathbunD Offline
                    Dan Rathbun
                    last edited by

                    What about another editor like GIMP ?

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • placidfuryP Offline
                      placidfury
                      last edited by

                      GIMP doesn't do vector graphics, no? It can import, but converts to raster. I tried a couple apps that work with SVG, to no avail - they all output different code in the SVG, and each one did different (incorrect) things when I tried to use them on my toolbar in SketchUp.

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        MSP_Greg
                        last edited by

                        @placidfury said:

                        or manually edit the SVG code so SketchUp will read it properly

                        Well, SVG is XML and Nokogiri would certainly be up to the task. Wouldn't even need SketchUp to do the processing...

                        Greg

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement