Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Unsolved Dynamically change SVG color or replace a color by another one

    QML and Qt Quick
    3
    5
    6500
    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.
    • D
      DavidM29 last edited by

      Hello,

      I have a menu with SVG images. I would like to change their color on focus. My SVG are simple logo made of transparent and black for example this one : 0_1528382263831_83432629-095b-4931-9220-c1701fe15a86-image.png
      What I want is to replace the black color by white without having to handle many images.
      Is that possible ?
      I tried ColorOverlay but it also replace the transparent with white color.

      Thank you in advance

      1 Reply Last reply Reply Quote 0
      • B
        Bernd B last edited by

        I think that will help you:
        https://forum.qt.io/topic/75115/qml-svg-change-color/6

        D 1 Reply Last reply Reply Quote 1
        • D
          DavidM29 @Bernd B last edited by

          @Bernd-B
          I tried to use ColorOverlay but it make the transparent color turn to white also. And I don't want that. I wan't to turn black into white only.

          1 Reply Last reply Reply Quote 0
          • M
            markugra last edited by

            Hi, I have no problems to color my svg files white with the approach mentioned by Bernd. Maybe the problem is in the format of your svg file (I had some problems with svg that contained groups or masks etc). To test that you could try a file from: https://material.io/tools/icons/?style=baseline
            those usually work for me

            1 Reply Last reply Reply Quote 2
            • D
              DavidM29 last edited by

              Thank you for that answer, I believe is due to the device I'm trying to run it on, because on the computer it works quite good.
              I hoped to have an other solution than this one. I will have to manage many images.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post