Giter Club home page Giter Club logo

Comments (3)

tcy1999 avatar tcy1999 commented on August 24, 2024

I was also trying to customize the search icon, and solved it by setting the --ifm-navbar-search-input-icon in the global css file of my site. For example,

:root {
  ...
  --ifm-navbar-search-input-icon: url('data:image/svg+xml;utf8,<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16px" width="16px">...</svg>');
}
  ...

Hope this helps.

from docusaurus-search-local.

paolochang avatar paolochang commented on August 24, 2024

Hi @tcy1999, Could you give me an example of color changing using variable based on your sample code block? I was able to change the color by adding name of the color like "red", "lime", but not with hex color code or variable.

from docusaurus-search-local.

MichelHMachado avatar MichelHMachado commented on August 24, 2024

To change the color dynamically using a variable or a hex color code, you need to utilize URL encoding for the color within the SVG's fill attribute. This ensures that special characters like "#" are properly represented in URLs and code.

For example, if you want to change the fill color of the SVG icon to a specific hex color code, such as "#FF5733", you would need to URL-encode it as follows:

background-image: url('data:image/svg+xml;utf8,<svg fill="%23FF5733" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16px" width="16px"><path d="M6.02945,10.20327a4.17382,4.17382,0,1,1,4.17382-4.17382A4.15609,4.15609,0,0,1,6.02945,10.20327Zm9.69195,4.2199L10.8989,9.59979A5.88021,5.88021,0,0,0,12.058,6.02856,6.00467,6.00467,0,1,0,9.59979,10.8989l4.82338,4.82338a.89729.89729,0,0,0,1.29912,0,.89749.89749,0,0,0-.00087-1.29909Z" /></svg>');

Use the %23 instead of #

from docusaurus-search-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.