ngx-nightmode
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "ngx-nightmode", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"peerDependencies": { | ||
@@ -5,0 +5,0 @@ "@angular/common": "^9.0.0", |
@@ -11,2 +11,74 @@ # Angular 9 Night Mode Library | ||
- Automatically shows Darkmode if the OS prefered theme is dark (if the browsers supports prefers-color-scheme) | ||
- Can be used programmatically without widget | ||
- Can be used programmatically without widget | ||
## How to Use `ngx-darkmode`? | ||
Navigate to your project's folder and run the following command: | ||
```bash | ||
$ npm install --save ngx-darkmode | ||
``` | ||
Next, import `NgxNightmodeModule` and add it to the `imports` array f your app: | ||
```ts | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { NgModule } from '@angular/core'; | ||
import { AppComponent } from './app.component'; | ||
import { NgxNightmodeModule } from 'ngx-nightmode'; | ||
@NgModule({ | ||
declarations: [ | ||
AppComponent | ||
], | ||
imports: [ | ||
BrowserModule, | ||
NgxNightmodeModule | ||
], | ||
providers: [], | ||
bootstrap: [AppComponent] | ||
}) | ||
export class AppModule { } | ||
``` | ||
## Use it | ||
```ts | ||
import { Component , OnInit } from '@angular/core'; | ||
import { NgxNightmodeService , WidgetOptions } from 'ngx-nightmode'; | ||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent implements OnInit { | ||
title = 'demo'; | ||
constructor(public nightmodeService: NgxNightmodeService){ | ||
} | ||
ngOnInit(): void { | ||
var opts: WidgetOptions = { | ||
bottom: '64px', // default: '32px' | ||
right: 'unset', // default: '32px' | ||
left: '32px', // default: 'unset' | ||
time: '0.5s', // default: '0.3s' | ||
mixColor: '#fff', // default: '#fff' | ||
backgroundColor: '#fff', // default: '#fff' | ||
buttonColorDark: '#100f2c', // default: '#100f2c' | ||
buttonColorLight: '#fff', // default: '#fff' | ||
saveInCookies: false, // default: true, | ||
label: '🌓', // default: '' | ||
autoMatchOsTheme: true // default: true | ||
} | ||
this.nightmodeService.showWidget(opts); | ||
} | ||
} | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77811
1
83