# CSS Modules A CSS module is a pure style override — theming, restyling, or a dark mode for a site. It uses the same `module.json` manifest as a [JS module](/extensions/js-module), but the substance is the stylesheet. ## File layout ``` my-theme/ ├── module.json # required ├── main.js # required — can be a near-empty stub ├── style.css # the actual styles └── icon.png # optional ``` ::: info A `main.js` is still required Even a pure CSS module needs a `main.js` (it can be a minimal stub). Set `runAt` to `DOCUMENT_START` so your styles apply as early as possible and avoid a flash of unstyled content. ::: ## `module.json` ```json { "id": "dark-reader-lite", "name": "Dark Reader Lite", "description": "A simple dark theme", "category": "THEME", "runAt": "DOCUMENT_START", "urlMatches": [ { "pattern": "*://news.ycombinator.com/*" } ], "permissions": ["CSS_INJECT"] } ``` Use `category: "STYLE_MODIFIER"` or `"THEME"`. The market's `hasCss` flag must be `true` and a `style.css` must be present — the validator checks that these agree. ## How CSS is injected When a module has CSS (`cssCode` / `style.css`), it is injected as a `