Comments (3)
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.
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.
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)
- build fail when add slug: filename.html
- Search icon doesn't change color between light/dark mode HOT 1
- Allow Search to open details html tag
- Japanese search problem
- Add theme option to set the search bar placeholder message HOT 1
- Docusaurus `tags` make search results incorrect and unreadable
- [Bug] - CI Fails when Used with Docusaurus 2.4.0
- `blogDir` allows `[]`
- No index entry generated for custom categories specified in sidebars.js
- Should search find documents based on front-matter keywords? HOT 4
- Support for Docusaurus 3.0 HOT 6
- Add support for newer languages
- Enable prebuild indexing
- HTML indexes, but not deep linking
- Huge Search Index HOT 1
- Nothing appears, no debug logs, no search index file or errors HOT 3
- Docusaurus React Root onRecoverableError: Error: Minified React error #418 and #423 HOT 5
- Can't start after installation HOT 7
- do not index unlisted articles in Docusaurus 3.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docusaurus-search-local.