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-overreacted-toggle

v1.0.3

Published

The dark mode toggle used in Dan Abramovs blog site

Downloads

5

Readme

gatsby-theme-overreacted-toggle

A Gatsby theme that implements Dan Abramovs dark mode toggle. Add to your Gatsby sites gatsby-config.js just like you would with a plugin.


module.exports = {

    plugins: ['gatsby-theme-overreacted-toggle'],
}

Example usage:

import React from 'react';
import {DarkModeToggle} from 'gatsby-theme-overreacted-toggle'

export default () => (
    <div style={{
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'space-around',
        alignItems: 'center',
        marginTop: '200px'
    }}>
        <DarkModeToggle/>
        <h1>Click the toggle to change sites color mode</h1>
    </div>
)

You can override any colors used in your application by shadowing the theme ui index components.

The original looks like this:

export default {
    // this enables the color modes feature
    // and is used as the name for the top-level colors object
    initialColorMode: 'light',
    // optionally enable custom properties
    // to help avoid a flash of colors on page load
    useCustomProperties: true,
    colors: {
        // these are the default light colors
        text: '#000',
        background: '#fff',
        primary: '#0057B8',
        accent: '#FFCD00',
        modes: {
            // this is the dark color mode colors
            dark: {
                text: '#fff',
                background: '#000',
                primary: '#FFCD00',
            },
        },
    },
};

To override the colors create a new folder in your src folder named gatsby-plugin-theme-ui Inside this folder create an index.js and copy the format of the above original, changing the colors to whatever you want.

To use these colors in your components import jsx from theme ui and add the jsx pragma. You can then use the sx prop and style any element inline. In the below example we are changing the h1 color to that of the primary color set in the shadowed gatsby-plugin-theme-ui index file.

/** @jsx jsx */
import { jsx } from 'theme-ui'
import {DarkModeToggle} from 'gatsby-theme-overreacted-toggle'

export default () => (
    <div style={{
        display: 'flex',
        flexDirection: 'column',
        justifyContent: 'space-around',
        alignItems: 'center',
        marginTop: '200px'
    }}>
        <DarkModeToggle/>
        <h1 sx={{
            color: 'primary'
        }}>Click the toggle to change sites color mode</h1>
    </div>
)

Built With

Authors

  • Rich Haines - Hungry Bear Studio

License

This project is licensed under the MIT License