@linzopen/css-guard-electron
v0.1.0
Published
Make any Electron window skinnable in three lines: register a scheme, point at a skin folder, apply.
Readme
css-guard-electron
Make an Electron window skinnable.
npm install css-guard-electronconst { registerSkinScheme, createSkinHost } = require("css-guard-electron");
registerSkinScheme(); // 必须在 app ready 之前
const skins = createSkinHost({ roots: [skinsDir] }); // ready 之后
skins.install();
skins.attach(win);
await skins.apply("midnight-harbor");Three things this does that are easy to get wrong, each of which shows up as "the skin doesn't seem to work":
- Registers the custom protocol before
ready. Too late is silent — assets just 404. - Serialises
insertCSS. Concurrent switches leave the previous skin's CSS in the page for good. Observed symptom: new palette applied, old backdrop still showing. - Runs the linter before injecting, and refuses skins that reach the network. See docs/security.md.
Full guide, including what the renderer side has to expose: docs/hosts.md.
MIT
