{"id":28092430,"url":"https://github.com/streamich/code-colors-react","last_synced_at":"2026-04-28T00:01:23.678Z","repository":{"id":178045959,"uuid":"661282491","full_name":"streamich/code-colors-react","owner":"streamich","description":"Code syntax highlighting React component","archived":false,"fork":false,"pushed_at":"2025-09-15T06:10:43.000Z","size":9866,"stargazers_count":7,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-15T08:24:41.347Z","etag":null,"topics":["code","color","component","highlight","pre","react","syntax"],"latest_commit_sha":null,"homepage":"https://streamich.github.io/code-colors-react/","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":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"streamich"}},"created_at":"2023-07-02T11:10:12.000Z","updated_at":"2025-09-15T06:10:08.000Z","dependencies_parsed_at":"2024-05-27T23:13:03.143Z","dependency_job_id":"5108a464-2dcc-4409-9ada-9ab53c9983bd","html_url":"https://github.com/streamich/code-colors-react","commit_stats":null,"previous_names":["streamich/code-colors-react"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/streamich/code-colors-react","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcode-colors-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcode-colors-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcode-colors-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcode-colors-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamich","download_url":"https://codeload.github.com/streamich/code-colors-react/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamich%2Fcode-colors-react/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32360116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["code","color","component","highlight","pre","react","syntax"],"created_at":"2025-05-13T13:14:35.742Z","updated_at":"2026-04-28T00:01:23.668Z","avatar_url":"https://github.com/streamich.png","language":"TypeScript","funding_links":["https://github.com/sponsors/streamich"],"categories":[],"sub_categories":[],"readme":"# code-colors-react\n\nReact component for code syntax highlighting. [**Preview 📕**][storybook]\n\n[storybook]: https://streamich.github.io/code-colors-react/?path=/story/stories-colortokens--hello-world\n\n**Why another code syntax highlighting package?**\n\n- A simple to use React component.\n- It is very lightweight, only ships a small React component, which loads\n  tokenization script (~35Kb) in a Web Worker on demand, on first usage.\n- The Prism.js tokenization script is loaded from the CDN asynchronously.\n- Runs tokenization in a Web Worker, so it doesn't block the main thread.\n- Emits Prism.js compatible HTML, so you can use any Prism.js [themes](https://cdn.jsdelivr.net/npm/prism-themes@1.9.0/themes/).\n- No layout shifts before the code is highlighted. While the code is being\n  highlighted in the Web Worker, the component renders plain text with the\n  correct dimensions.\n- If code changes while it is being highlighted, the component will cancel the\n  previous highlighting and start a new one.\n- Interactive CSS on mouse hover.\n\n## Installation\n\n```sh\nnpm install code-colors-react\n```\n\n## Usage\n\n```js\nimport { ColorTokens } from \"code-colors-react\";\n\n\u003cpre\u003e\n  \u003cColorTokens code={\"console.log('hello world');\"} lang={\"js\"} /\u003e\n\u003c/pre\u003e;\n```\n\n#### Props\n\n- `code` \u0026mdash; The code to highlight.\n- `lang` \u0026mdash; The language of the code. If omitted, it will try to autodetect the language.\n- `as` \u0026mdash; The root element to render. Defaults to `\"code\"`.\n\n## Styling\n\nTo style the highlighted code, you can use any of the [pre-defined themes](https://cdn.jsdelivr.net/npm/prism-themes@1.9.0/themes/) from\nPrism.\n\nYou can do it in JavaScript like so:\n\n```js\nimport { loadCss } from \"thingies/lib/loadCss\";\n\nconst theme = \"github\";\nconst url = `https://cdn.jsdelivr.net/npm/prism-themes@1.9.0/themes/${theme}.min.css`;\n\nloadCss(url);\n```\n\n## Examples\n\nBasic JavaScript:\n\n![image](https://github.com/user-attachments/assets/ab0574ab-e99f-4a05-b187-c4a5d6d48850)\n\nNegative values with red background:\n\n![image](https://github.com/user-attachments/assets/eddeb75e-7e85-4c88-8a80-04fa70744bb6)\n\nNested languages: JavaScript and CSS inside HTML:\n\n![image](https://github.com/user-attachments/assets/68f296f7-994b-4ddd-b7ce-401cb536a607)\n\n[See more examples][storybook].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcode-colors-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamich%2Fcode-colors-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamich%2Fcode-colors-react/lists"}