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

Customizable search button #107

Closed
LookRain opened this issue Mar 23, 2022 · 6 comments
Closed

Customizable search button #107

LookRain opened this issue Mar 23, 2022 · 6 comments

Comments

@LookRain
Copy link

I'm very satisfied with this plugin so far, however, the default search button does not really fit my docsite. So is there any way to customize the UI for the button? If not, is it a planned feature for future versions? thanks

image

@marcusnewton
Copy link

You can target it using the global stylesheet under src/css/custom.css

@LookRain
Copy link
Author

got it. It works for me for now, but it would be great if we can replace the default button with a React component if the design deviates from the default one too much and customizing CSS is not enough.

@gentledepp
Copy link

Could you please give me a hint what I am doing wrong?

  1. I installed the plugin just as described in your wiki and a normal docusaurus v2 configuration using presets classic:
    image

  2. when adding the following lines to my custom css, they do not have any effect:
    image

So I fired up chrome dev tools and it seems, that my custom.css is inserted into the html BEFORE the searchbar css is added:
image

So

  1. is there a way to change the order of the css definitions, so that my custom.css can actually override the existing variables?
  2. or am I doing something fundamentally wrong here?

@ItsJustMiaouss
Copy link

Hey @gentledepp,

If you want to change the color using the root variables you have to:

  1. Use the RGB colors instead of the default CSS shortcut or HEX (e.g 255, 0, 0 instead of red or #ff1100).
  2. Make sure you have set the priority !important after defining the color to override the previous styling rules.

Example:

:root {
  --aa-primary-color-rgb: 255, 0, 0 !important;
  --aa-muted-color-rgb: 255, 0, 0 !important;
  /* ... */
}

If you use the dark theme, then replace :root { ... } by [data-theme='dark'] { ... }.

@gentledepp
Copy link

This totally worked. Thank you so much!!

@cmfcmf
Copy link
Owner

cmfcmf commented Jun 12, 2022

Thanks @ItsJustMiaouss! I linked your comment from the README :)

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

5 participants