{"id":19252725,"url":"https://github.com/morevm/console-css","last_synced_at":"2026-04-12T23:54:18.333Z","repository":{"id":61113165,"uuid":"548441105","full_name":"MorevM/console-css","owner":"MorevM","description":"Style browser console messages with CSS","archived":false,"fork":false,"pushed_at":"2022-10-26T15:50:49.000Z","size":373,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-30T18:38:08.431Z","etag":null,"topics":["console","css","devtools"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MorevM.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-09T15:20:28.000Z","updated_at":"2022-10-26T15:44:45.000Z","dependencies_parsed_at":"2022-10-11T06:21:43.061Z","dependency_job_id":null,"html_url":"https://github.com/MorevM/console-css","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/MorevM/console-css","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorevM%2Fconsole-css","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorevM%2Fconsole-css/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorevM%2Fconsole-css/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorevM%2Fconsole-css/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MorevM","download_url":"https://codeload.github.com/MorevM/console-css/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MorevM%2Fconsole-css/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269819032,"owners_count":24480087,"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":["console","css","devtools"],"created_at":"2024-11-09T18:28:12.250Z","updated_at":"2026-04-12T23:54:18.296Z","avatar_url":"https://github.com/MorevM.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @morev/console-css\n\nThe library to style browser console messages.\n\n![Stability of \"master\" branch](https://img.shields.io/github/workflow/status/MorevM/console-css/Build/master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n![Last commit](https://img.shields.io/github/last-commit/morevm/console-css)\n![Release version](https://img.shields.io/github/v/release/morevm/console-css?include_prereleases)\n![GitHub Release Date](https://img.shields.io/github/release-date/morevm/console-css)\n![Keywords](https://img.shields.io/github/package-json/keywords/morevm/console-css)\n\n## Why?\n\n`¯\\_(ツ)_/¯`\n\nSometimes you may want to warn users of your site like Facebook does:\n\n![An example of using styled messages in the console on the Facebook website](./.github/images/facebook-example.jpg)\n\nPerhaps you want to make a prominent message to the developers like BBC does:\n\n![An example of using styled messages in the console on the BBC website](./.github/images/bbc-example.jpg)\n\nMaybe you want to enchance some of your custom dev utilities, etc.\n\n**BUT**\n\nIf you want to print BBC News logotype in the console, you need to write smth like that:\n```js\nconsole.log('%cB%c %cB%c %cB%c %cNEWS       %c', 'font-style:bold;font-size:40px;padding:4px 16px;background:#000;color:#fff;', 'background:none', 'font-style:bold;font-size:40px;padding:4px 16px;background:#000;color:#fff;', 'background:none', 'font-style:bold;font-size:40px;padding:4px 16px;background:#000;color:#fff;', 'background:none', 'font-style:bold;font-size:40px;padding:4px 16px;background:#b80000;color:#fff;', 'background:none');\n```\n\nCopy-paste into you browser console and press `Enter` to see the result. \\\nThe code doesn't look friendly, huh?\n\n**But there is another way:**\n\n```js\nimport ConsoleCSS from '@morev/console-css';\n\nConsoleCSS.add(`\n  .letter {\n    font-style: bold;\n    font-size: 40px;\n    padding: 4px 16px;\n    background: #000000;\n    color: #ffffff;\n  }\n  .bg-red {\n    background: #ff0000;\n  }\n`);\n\nConsoleCSS.styled.log(`\n  \u003cspan class=\"letter\"\u003eB\u003c/span\u003e\n  \u003cspan class=\"letter\"\u003eB\u003c/span\u003e\n  \u003cspan class=\"letter\"\u003eC\u003c/span\u003e\n  \u003cspan class=\"letter bg-red\"\u003eNews\u003c/span\u003e\n`)\n```\n---\n\n## Installation\n\n### Using `yarn`\n\n```bash\nyarn add @morev/console-css\n```\n\n### Using `npm`\n\n```bash\nnpm install @morev/console-css\n```\n\n### Using `pnpm`\n\n```bash\npnpm add @morev/console-css\n```\n\n## Usage\n\nThe package exports the ConsoleCSS class instance that considered singleton. \\\nIf used directly in HTML without any bundler - it's available via `window.ConsoleCSS`.\n\n\u003e **Important:** The package only works in browser. It doesn't fall but does nothing on server side.\n\n### Default styles\n\nBy default, the package styles only well-known HTML tags:\n* `\u003cb\u003e` - **bold** text\n* `\u003ci\u003e` - *italic* text\n* `\u003cu\u003e` - _underlined_ text\n* `\u003cs\u003e` - ~~strikethrough~~ text\n\n### Inline style\n\nYou may use inline styles:\n\n```js\nimport ConsoleCSS from '@morev/console-css';\n\nConsoleCSS.styled.log(`\u003cb style=\"color: red;\"\u003eRed bold text\u003c/b\u003e`);\n```\n\n### Adding custom CSS tokens\n\nThe core class has a method `.add(rules: string)` that accepts a CSS-like string with needed tokens. \\\nYou can use `.add()` method multiple times.\n\n\u003e This input string isn't validated, so make sure your CSS syntax is correct.\n\n```ts\nimport ConsoleCSS from '@morev/console-css';\n\nConsoleCSS.add(`\n  .block { color: red; text-decoration: underline; }\n`);\n\nConsoleCSS.styled.log('\u003cspan class=\"block\"\u003eRed underlined text\u003c/span\u003e');\n```\n\n### Override the default `window.console` object\n\nThat might be annoying to remember about custom styled messages class, so the library provides a way to replace global `window.console`\n\n```ts\nimport ConsoleCSS from '@morev/console-css';\n\n// No matters before or after `.override()` call\nConsoleCSS.add(`\n  .block { color: red; text-decoration: underline; }\n`);\n\nConsoleCSS.override();\n\nconsole.log('Wow, \u003cspan class=\"block\"\u003ea styled message\u003c/span\u003e using native `console.log`!');\n\n// Restore the original `window.console`\nConsoleCSS.restore();\n\nconsole.log('No longer \u003cspan class=\"block\"\u003estyled\u003c/span\u003e messages :(');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorevm%2Fconsole-css","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorevm%2Fconsole-css","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorevm%2Fconsole-css/lists"}