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

Search icon doesn't change color between light/dark mode #287

Open
tuckergordon opened this issue Apr 27, 2023 · 2 comments
Open

Search icon doesn't change color between light/dark mode #287

tuckergordon opened this issue Apr 27, 2023 · 2 comments

Comments

@tuckergordon
Copy link

The search icon as defined in --ifm-navbar-search-input-icon is uses currentColor:

--ifm-navbar-search-input-icon: url('data:image/svg+xml;utf8,<svg fill="currentColor" ...

However, this does not have the intended effect because currentColor does not get applied on images rendered using url(). This results in the search icon not changing color when switching between light/dark theme (and makes it hard to customize the color more generally).

Perhaps a more flexible approach would be to use an actual SVG in the element, similar to how Docusarus has implemented it on their website:
image

@slorber
Copy link
Collaborator

slorber commented Apr 28, 2023

As far as I know this CSS var is not even used on Docusaurus,

But is only found in Infima search: https://infima.dev/demo/

I'll keep this issue open because we should probably delete it from Infima, it's confusing for Docusaurus users and useless


The only official Docusaurus search icon is from the Algolia search widget lib and using a SVG, not a CSS var.

CleanShot 2023-04-28 at 12 56 10@2x

CleanShot 2023-04-28 at 12 57 02@2x


And it adapts to the current theme using a CSS var that we provide:

.DocSearch-Button .DocSearch-Search-Icon {
    --docsearch-text-color: cyan;
    color: var(--docsearch-text-color);
}

CleanShot 2023-04-28 at 13 00 08@2x

@tuckergordon
Copy link
Author

I'll keep this issue open because we should probably delete it from Infima, it's confusing for Docusaurus users and useless

Agreed - would be good to remove it entirely and replace the demos with an SVG-based solution.

I ran into this while using the easyops-cn/docusaurus-search-local library, so I will make a issue ticket in that repo and reference this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants