1.0.2 • Published 3 months ago

docsify-dark-switch v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

docsify-dark-switch

NPM License: MIT jsDelivr

A docsify plugin which can add light and dark themes switching functionality to your docsify site.

Screenshots

npm.io

Installation

<!-- head -->
<!-- set theme stylesheet the corresponding title, you can set multiple  -->
<link rel="stylesheet" title="light" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css">
<link rel="stylesheet" title="dark" href="//cdn.jsdelivr.net/npm/docsify/themes/dark.css">

<!-- link docsify-dark-switch.css  -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify-dark-switch/dist/docsify-dark-switch.css">

<!-- Also insert you custom css -->

<!-- body -->
<!-- script docsify-dark-switch.js or docsify-dark-switch.min.js  -->
<script src="//cdn.jsdelivr.net/npm/docsify-dark-switch/dist/docsify-dark-switch.min.js"></script>

This example uses the docsify official theme. You can also reference the theme css file you want, and you need to set the corresponding title. When switching the theme, the plugin will automatically switch the theme css file based on the title.

More docsify official themes: https://docsify.js.org/#/themes

CDN

If the cdn reference cannot be referenced, you can choose another cdn below, or download it to a local reference.

Configure

<script>
window.$docsify = {
    // ...
    darkSwitch: {
        fixed: false,
        debug: false,
    },
    // ...
}
</script>
ArgumentDescriptionTypeDefault
fixedWhether the switch button is fixed, that is, it is fixed in the upper right corner and does not scroll with the scroll bar. The default is not fixed.booleanfalse
debugWhether to enable debug mode, it is turned off by default.booleanfalse
styleSet button style, which can be used to set button position and style.object{ top: '25px', right: '60px' }

Remembering the themes switching

This plugin will remember the theme switching set. That means that when the browser is closed and then reopened, the theme switching will still be set. This is achieved via localStorage.

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago