shadow-dom-inject-styles
A helper function to easily modify shadow dom css.
11,985
| Install | |
|---|---|
npm install shadow-dom-inject-styles |
|
| Latest Version: | 1.0.3 |
| License: | MIT |
| Last Updated: | Jun 11, 2020 |
| Links: | npm |
Maintainer: adamlacombe
Shadow-DOM-inject-styles
A helper function to easily modify Shadow DOM CSS.
Install
npm install shadow-dom-inject-styles --save
Vanilla JS Example / Demo
<script type="module">
import {injectStyles} from 'https://unpkg.com/shadow-dom-inject-styles@latest/dist/index.js';
setTimeout(() => {
const toolbar = document.querySelector('ion-app > ion-header > ion-toolbar');
// language=CSS
const styles = `
.toolbar-background {
background: red !important;
}
.toolbar-container {
color: #fff !important;
}
`;
injectStyles(toolbar, '.toolbar-background', styles);
}, 200);
</script>
Typescript Example
import {injectStyles} from 'shadow-dom-inject-styles';
const toolbar = (this.el.querySelector('ion-header > ion-toolbar') as HTMLElement);
// language=CSS
const styles = `
.toolbar-background {
background: red !important;;
}
`;
injectStyles(toolbar, '.toolbar-background', styles);
Related Packages
@bulmil/core
93,767
159
the-themex-project
Themex aims to prevent a blank screen in your IDE and serves as a solid foundati...
7,230
18
Version History
| Version | Released | License |
|---|---|---|
| 1.0.3 | MIT | |
| 1.0.2 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT |