Ask Your Question
4

What is the procedure to modify the light/dark mode icon in Docusaurus?

asked 2023-06-28 04:13:42 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-06-28 04:36:02 +0000

devzero gravatar image

To modify the light/dark mode icon in Docusaurus, follow these steps:

  1. Locate the icon file: The existing icon file is located in the "static/img" folder of your Docusaurus project. Look for the following files: "light-mode-icon.svg" and "dark-mode-icon.svg".

  2. Replace the icon file: You can replace the icon file with any other icon of your preference. Make sure to name it the same as the original icon file so that it can be recognized by Docusaurus.

  3. Update the configuration file: The configuration file for Docusaurus is called "docusaurus.config.js". Open this file and look for the following code:

themeConfig: {
  colorMode: {
    defaultMode: 'light',
    switchConfig: {
      darkIcon: '๐ŸŒ‘',
      darkIconStyle: {},
      lightIcon: 'โ˜€๏ธ',
      lightIconStyle: {},
    },
  },
},

In this code, you can see the two icon files being referenced โ€“ "darkIcon" and "lightIcon". Replace the file names with the names of your new icon files.

  1. Save and deploy: Save the configuration file and deploy your project. Your new light/dark mode icon should now be displayed.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-28 04:13:42 +0000

Seen: 12 times

Last updated: Jun 28 '23