npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-theme-ghost-dark-mode

v2.0.0

Published

Gatsby theme to integrate dark mode into gatsby-theme-try-ghost.

Downloads

35

Readme

gatsby-theme-ghost-dark-mode

Released under MIT license. gatsby-theme-ghost-dark-mode npm package version. PRs welcome!

Integrates dark mode into gatsby-theme-try-ghost. This theme makes use of latent-component-shadowing and showcases best practices for adding custom themes to gatsby-theme-try-ghost.

Install

yarn add gatsby-theme-ghost-dark-mode

Dependencies

This theme is an add-on theme designed to seamlessly integrate with gatsby-theme-try-ghost. The theme uses functions provided by gatsby-theme-try-ghost, so installing gatsby-theme-try-ghost is required.

yarn add gatsby-theme-try-ghost

How to use

// In your gatsby-config.js
plugins: [
    {
        resolve: `gatsby-theme-ghost-dark-mode`,
        options: {
            // Set to true if you want your theme to default to dark mode (default: false)
            // Note that this setting has an effect only, if
            //    1. The user has not changed the dark mode
            //    2. Dark mode is not reported from OS
            defaultModeDark: false,
            // If you want the defaultModeDark setting to take precedence
            // over the mode reported from OS, set this to true (default: false)
            // Note that user choice still takes precedence over this setting
            overrideOS: false,
        },
    },
]

Details

This Gatsby theme plugin hooks into the gatsby-theme-try-ghost theme and adds a dark mode toggle in the top right navigation bar. User's dark mode settings are persisted to localStore, so they should remain on page revisits. If the functionality is provided by the browser, dark mode setting is read from the OS and that setting is taken for first time use. The defaultModeDark setting is taken, if OS does not report dark mode or if the user has not chosen a theme preference in the OS. Finally, OS settings can be overruled with overrideOS.

This plugin also shows how to best customize gatsby-theme-try-ghost. The latent-component-shadowing approach used here is very general and is an amazing concept. This is useful if you plan on customizing gatsby-theme-try-ghost yourself.

Limitations

If you use PrismJS your prism styles might be changed. Currently, the best option is to use a dark PrismJS style that looks great in both dark and light mode.

Contributions

PRs are welcome! Consider contributing to this project if you are missing feature that is also useful for others. Explore this guide, to get some more ideas.

Copyright & License

Copyright (c) 2020 styxlab - Released under the MIT license.