19.0.0 • Published 8 months ago

ngx-nightwind v19.0.0

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

NgxNightwind

NgxNightwind is a library that provides a service with helper functions to easily manage nightwind dark mode in Angular applications.

Instalation

Before installing NgxNightwind, make sure to install Nightwind as explained in Nightwind GitHub repository, then run:

npm install ngx-nightwind

Usage

First, provide the NgxNightwindService using the provideNgxNightwind() method in your application configuration:

import { provideNgxNightwind } from 'ngx-nightwind';

export const appConfig: ApplicationConfig = {
  providers: [
    ...
      provideNgxNightwind(),
    // or use provideNgxNightwind('dark') 
    // to override the default light mode 
    // when no preferred theme is set 
    // or no previous record in localStorage is present
  ]
};

After providing the service, you can use it to manipulate the mode in your components:

import { NgxNightwind } from 'ngx-nightwind';

...

// Inject the service in your component constructor
constructor(private ngxNightwind: NgxNightwind) {
  
  // Switches to light mode
  this.ngxNightwind.enableLight();
  
  // Switches to dark mode
  this.ngxNightwind.enableDark();
  
  // Toggles between light and dark mode
  this.ngxNightwind.toggle();
  
  // Gets the current mode: 'light' or 'dark'
  this.ngxNightwind.currentMode;
  
  // Returns true if the current mode is light
  this.ngxNightwind.isLight;
  
  // Returns true if the current mode is dark
  this.ngxNightwind.isDark;

}

Contribution

Feel free to contribute to NgxNightwind by opening issues or pull requests in the GitHub repository.

License

NgxNightwind is licensed under the MIT License.

19.0.0

8 months ago

18.0.0

1 year ago

12.0.1

1 year ago

17.1.3

1 year ago

15.0.1

1 year ago

14.0.1

1 year ago

13.0.1

1 year ago

16.0.1

1 year ago

17.1.2

1 year ago

17.1.1

1 year ago

12.0.0

1 year ago

13.0.0

1 year ago

14.0.0

1 year ago

16.0.0

1 year ago

15.0.0

1 year ago

17.1.0

1 year ago

17.0.3

1 year ago

17.0.2

1 year ago

17.0.1

1 year ago

17.0.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago