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

@asomani/darkmode

v1.1.2

Published

Easy-to-use customizable dark mode for react πŸŒ’

Downloads

34

Readme

An easy-to-use customizable dark mode react component.

Demo

Demo Website!

Install

npm i --save @asomani/darkmode
yarn add @asomani/darkmode

Import

import DarkMode from '@asomani/darkmode'

Use

Use it as a wrapper around everything you want to incorporate into low light mode (for most people, this would be the entire page –– and thus, the outermost component). An example:

ReactDOM.render(
  <DarkMode>
    <App />
  </DarkMode>, document.getElementById('root'));

Basic Rules For Passing Arguments

  • If you don't mention the prop (eg, if you pass in no value for background), the component will render into the default palette that I've set up.
  • If "" is set as the value of the prop (eg, <DarkMode background="" />) then no color change shall take place for that passed in prop.
  • If a certain valid color is passed in as the value of the prop (ed, <DarkMode background="black" /> ), then the HTML of that prop shall be rendered in that color.

Passed-in Prop Options

background

Set the background of the entire page to the passed in color. If nothing is passed in, sets background color to #121212

default

Sets the default color of the text of the page, should it not be override by some more specific color. If nothing is passed in, sets text color to #f0f0f0e5

h1, h2, h3, h4, h5, h6, p, code

Sets the value for all specific text to passed in color. If nothing is passed in, sets text color to #f0f0f0e5

a

Sets the value for all links to passed in color. If nothing is passed in, sets text color to #e454f7

ahover

Sets the value for all links being hovered over to passed in color. If nothing is passed in, sets text color to #7e0a8d

codebackground

Sets the value for code line background color to passed in color. If nothing is passed in, sets background color to #784e85b2

Example

import React from 'react'
import DarkMode from '@asomani/darkmode'

const App = () => (
  <div>
    <h1> This is h1 text. </h1>
    <h2> This is h2 text, </h2>
    This is text that will be overriden by the default parameter.
  </div>
);

ReactDOM.render(
  <DarkMode background="black" default="white" h1="orange" h2="green">
    <App />
  </DarkMode>, document.getElementById('root'));

Contributing 🀝

If you're interested in helping out on this project, fork this repo. In the darkmode folder is the main component. It's pretty self-explanatory in that file, in my opinion.

Currently, I'm working on:

  • Adding some parameters to pass in
  • Giving people the ability to pass in entire stylesheets
  • Setting up an option to pass in a custom toggle
  • Making toggle location more variable

Made with β™₯️ by asomani