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

@ngx-dark-mode-toggle/core

v1.0.2

Published

A lightweight Angular component for toggling between dark and light mode, with customizable styling and persistent theme storage for a consistent user experience.

Downloads

434

Readme

Ngx-Dark-Mode-Toggle

Demo

Live demo is available on Stackblitz

Overview

The @ngx-dark-mode/core Library is a simple and lightweight Angular component that allows users to switch between dark and light themes. This customizable toggle button provides an enhanced user experience with support for modern design practices.

Features

  • Easy Integration: Quickly add a dark/light mode toggle to any Angular application.

  • Customizable Appearance: Customizable toggle button design to match your application’s aesthetics.

  • Persistent Mode: Automatically saves the user’s mode preference in local storage, ensuring the selected mode is applied on subsequent visits.

  • Lightweight: Minimal impact on your application’s performance.

Installation

npm i @ngx-dark-mode-toggle/core`

Usage

  1. Import The Component: Add the component to your Angular component class:

    import { Component } from '@angular/core';
    import { NgxDarkModeComponent } from '@ngx-dark-mode-toggle/core';
    
    @Component({
       selector: 'app-root',
       standalone: true,
       imports: [NgxDarkModeComponent],
       templateUrl: './app.component.html',
       styleUrl: './app.component.scss',
    })
  2. Add the Toggle Component: Add the component to your Angular component class:

     <lib-ngx-dark-mode></lib-ngx-dark-mode>
  3. Customizing Styles for Dark Mode (Optional): If you want to customize the appearance of your component in dark mode, you can easily do so by defining specific styles in your root style.scss file.

    For example, if your component has a CSS class like this:

    .site-header {
        background-color: #f67b4e;
        color: #ffffff;
    }

    And you want to overwrite the background color when dark mode is enabled, you can add the following styles to your style.scss:

    body.dark .site-header {
        background-color: #CC5500 !important;
    }

Options

@ngx-dark-mode-toggle/core ships with the following options:

| Option | Description | Default | |---------------------|------------------------------------------------------------|------------------| | disableModeStorage| Disables saving the mode in local storage. | false | | hideLabel | Hides the label next to the toggle button. | false | | labelText | Specifies the text of the label next to the toggle button. | 'Dark mode' |

You can configure the <lib-ngx-dark-mode> component with the following options:

<lib-ngx-dark-mode
  [disableModeStorage]="true"
  [hideLabel]="false"
  [labelText]="'Dark'">
</lib-ngx-dark-mode>

Have an Issue or Feature Request?

If you encounter any issues or have a feature request, we'd love to hear from you! Please feel free to open an issue on our GitHub repository.

Whether it's a bug report, a suggestion for improvement, or a feature you'd like to see, your feedback helps us make this library better for everyone.