{"id":30180916,"url":"https://github.com/streamich/nano-theme","last_synced_at":"2025-08-12T08:06:13.207Z","repository":{"id":178310548,"uuid":"661673050","full_name":"streamich/nano-theme","owner":"streamich","description":"CSS theming for web apps","archived":false,"fork":false,"pushed_at":"2025-08-10T15:02:28.000Z","size":179,"stargazers_count":6,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-10T17:15:46.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"streamich"}},"created_at":"2023-07-03T11:49:23.000Z","updated_at":"2025-07-07T09:53:44.000Z","dependencies_parsed_at":"2024-03-11T05:27:38.691Z","dependency_job_id":"461bfcdc-7304-4acb-a481-8dba272f101c","html_url":"https://github.com/streamich/nano-theme","commit_stats":{"total_commits":66,"total_committers":2,"mean_commits":33.0,"dds":"0.31818181818181823","last_synced_commit":"0ee533e7b7e61d3e649623fb32fcea867e9d0b91"},"previous_names":["streamich/nano-theme"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/nano-theme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fnano-theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fnano-theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fnano-theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fnano-theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/nano-theme/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fnano-theme/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269922942,"owners_count":24497012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T08:06:05.223Z","updated_at":"2025-08-12T08:06:13.195Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":["https://github.com/sponsors/streamich"],"categories":[],"sub_categories":[],"readme":"# nano-theme\n\nA light and opinionated distribution of [`nano-css`](https://github.com/streamich/nano-css).\nIt ships all necessary dynamic tooling for most CSS-in-JS use cases, while in very\nlightweight packaging. `nano-theme` also ships predefined light and dark themes.\nAs well as colorful color palette, predefined breakpoints and global CSS reset.\n\n\n## Installation\n\n```sh\nnpm i nano-theme\n```\n\n\n## Usage\n\nFirst you might want to reset the global CSS.\n\n```ts\nimport 'nano-theme/lib/global-reset';\n```\n\nNow use the `rule` utility to create CSS classes.\n\n```ts\nimport {rule} from 'nano-theme';\n\nconst className = rule({\n  color: 'red',\n  fontSize: 16,\n  '@media screen and (min-width: 768px)': {\n    color: 'blue',\n  },\n});\n```\n\nYou can use [shorthand \"atoms\"](https://github.com/streamich/nano-css/blob/master/docs/atoms.md):\n\n```ts\nimport {rule} from 'nano-theme';\n\nconst className = rule({\n  col: 'red',\n  fz: 16,\n  '@media screen and (min-width: 768px)': {\n    col: 'blue',\n  },\n});\n```\n\nCreate CSS animations.\n\n```ts\nimport {keyframes} from 'nano-theme';\n\nconst animationName = keyframes({\n  from: {\n    opacity: 0,\n  },\n  to: {\n    opacity: 1,\n  },\n});\n```\n\nImport various theming helpers.\n\n```ts\nimport {theme, font, colors, b1, b2, b3, b4} from 'nano-theme';\n```\n\n\n### React Usage\n\nReact integration is also provided:\n\n```tsx\nimport {Provider, GlobalCss, useTheme, useRule, makeRule} from 'nano-theme';\n```\n\nThe `Provider` components sets the theme for the entire application. And `GlobalCss`\ncomponent applies some global CSS, based on the current theme.\n\n```tsx\n\u003cProvider theme={'light'}\u003e\n  \u003cGlobalCss /\u003e\n  \u003cMyApp /\u003e\n\u003cProvider/\u003e\n```\n\nThe `useTheme` hook returns the current theme.\n\n```tsx\nconst theme = useTheme();\n```\n\nThe `useRule` hook and `makeRule` function are used to dynamically create CSS classes at render-time.\n\n`useRule` example:\n\n```jsx\nconst MyComponent = () =\u003e {\n  const className = useRule({\n    col: 'red',\n    fz: 16,\n    '@media screen and (min-width: 768px)': {\n      col: 'blue',\n    },\n  });\n\n  return \u003cdiv className={className}\u003eHello\u003c/div\u003e;\n};\n```\n\n`makeRule` example:\n\n```jsx\nconst useClassName = makeRule({\n  color: 'red',\n  fontSize: 16,\n  '@media screen and (min-width: 768px)': {\n    color: 'blue',\n  },\n});\n\nconst MyComponent = () =\u003e {\n  const className = useClassName();\n  \n  return \u003cdiv className={className}\u003eHello\u003c/div\u003e;\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fnano-theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Fnano-theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fnano-theme/lists"}