Skip to content

Commit 5b4a624

Browse files
committed
Add custom tint support
1 parent 77235fa commit 5b4a624

17 files changed

Lines changed: 84 additions & 37 deletions

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,23 @@ import '@khmyznikov/pwa-install';
106106
```
107107
*Make a good manifest file and don't use name/descr/icon params. Boolean attributes needs to be removed to act like "false"*
108108

109+
## Custom Styles
110+
111+
*Only the Apple template supports styling, and only the tint color option is available as of today. More to come.*
112+
```html
113+
<!-- As attribute (JSON string) -->
114+
<pwa-install styles='{"--tint-color": "#6366f1"}'></pwa-install>
115+
```
116+
117+
```javascript
118+
// As property (object)
119+
const pwaInstall = document.querySelector('pwa-install');
120+
pwaInstall.styles = { '--tint-color': '#6366f1' };
121+
122+
// Or as attribute via JavaScript
123+
pwaInstall.setAttribute('styles', JSON.stringify({ '--tint-color': '#6366f1' }));
124+
```
125+
109126
<br>
110127

111128
## Supported events
@@ -137,6 +154,7 @@ This is **not** a error and **not** a bug. This means that the component success
137154
- isInstallAvailable: boolean
138155
- isAppleMobilePlatform: boolean
139156
- isAppleDesktopPlatform: boolean
157+
- isApple26Plus: boolean
140158
- isUnderStandaloneMode: boolean
141159
- isRelatedAppsInstalled: boolean
142160

custom-elements.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,14 @@
437437
},
438438
"default": "false",
439439
"fieldName": "useLocalStorage"
440+
},
441+
{
442+
"name": "styles",
443+
"type": {
444+
"text": "Record<string, string>"
445+
},
446+
"default": "{}",
447+
"fieldName": "styles"
440448
}
441449
],
442450
"superclass": {

dist/pwa-install.bundle.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pwa-install.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pwa-install.es.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pwa-install.es.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-legacy/pwa-install.react-legacy.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-legacy/pwa-install.react-legacy.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export declare class PWAInstallElement extends LitElement {
1616
disableClose: boolean;
1717
disableFallback: boolean;
1818
useLocalStorage: boolean;
19+
styles: Record<string, string>;
1920
static get styles(): CSSStyleSheet[];
2021
externalPromptEvent: BeforeInstallPromptEvent | null;
2122
platforms: BeforeInstallPromptEvent['platforms'];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { WebAppManifest } from 'web-app-manifest';
2-
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean, isRTL?: boolean, isApple26Plus?: boolean, isDesktop?: boolean) => import("lit").TemplateResult<1>;
2+
declare const template: (name: string, description: string, installDescription: string, disableDescription: boolean, disableScreenshots: boolean, disableClose: boolean, icon: string, manifest: WebAppManifest, installAvailable: any, hideDialog: any, howToForApple: any, howToRequested: boolean, toggleGallery: any, galleryRequested: boolean, isRTL?: boolean, isApple26Plus?: boolean, isDesktop?: boolean, customStyles?: Record<string, string>) => import("lit").TemplateResult<1>;
33
export default template;

0 commit comments

Comments
 (0)