{"id":13805660,"url":"https://github.com/thecodrr/crayon","last_synced_at":"2025-02-27T14:36:10.918Z","repository":{"id":47739742,"uuid":"221075169","full_name":"thecodrr/crayon","owner":"thecodrr","description":"🖍️ Paint your terminal output like Picasso 🎨","archived":false,"fork":false,"pushed_at":"2024-02-02T12:48:59.000Z","size":27,"stargazers_count":58,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-10T13:10:27.023Z","etag":null,"topics":["chalk","color","console","terminal","terminal-colors","terminal-style","v","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","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/thecodrr.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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"thecodrr","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-11-11T21:40:37.000Z","updated_at":"2025-01-02T18:52:31.000Z","dependencies_parsed_at":"2024-08-04T01:15:22.384Z","dependency_job_id":null,"html_url":"https://github.com/thecodrr/crayon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodrr%2Fcrayon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodrr%2Fcrayon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodrr%2Fcrayon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodrr%2Fcrayon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodrr","download_url":"https://codeload.github.com/thecodrr/crayon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241024262,"owners_count":19896202,"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","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":["chalk","color","console","terminal","terminal-colors","terminal-style","v","vlang"],"created_at":"2024-08-04T01:01:03.532Z","updated_at":"2025-02-27T14:36:10.877Z","avatar_url":"https://github.com/thecodrr.png","language":"V","funding_links":["https://ko-fi.com/thecodrr"],"categories":["Libraries"],"sub_categories":["Text processing"],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1 align=\"center\"\u003e🖍️ Crayon\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\nAn extremely simple way to turn your bland terminal output into beautifully styled text.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://i.imgur.com/BR0r2zr.png\"/\u003e\n\u003c/p\u003e\n\n## Installation:\n\nInstall using `vpkg`\n\n```bash\nvpkg get https://github.com/thecodrr/crayon\n```\n\nInstall using v's builtin vpm (you will need to import the module with: `import thecodrr.crayon` with this method of installation):\n\n```bash\nv install thecodrr.crayon\n```\n\nInstall using `git`:\n\n```bash\ncd path/to/your/project\ngit clone https://github.com/thecodrr/crayon\n# Or add it as a submodule\ngit submodule add https://github.com/thecodrr/crayon crayon \u0026\u0026 git submodule update --init --recursive\n```\n\nThen in the wherever you want to use it:\n\n```javascript\nimport crayon\n```\n\nAnd that's it!\n\n## Usage\n\n### crayon.new(texts ...`string`)\n\nInitializes a new `Crayon` for the specified text. You can pass multiple strings in the `texts` argument. Nesting `Crayon`s is supported (see example below).\n\n`crayon.new` returns a `Chalk` by default. Turn it into a styled `string` using the `.str()` function\n\n```javascript\ncrayon.new(\"Hello\", crayon.new(\"world\").bold().str()).cyan().underline().str()\n```\n\n### crayon.color(text `string`)\n\nUse this to style the text using the template API.\n\n```javascript\ncrayon.color(\"{bold.underline I am bold and underlined} and I am not\")\n```\n\nEach `template` starts with `{` and ends with `}`. All styles must come at the beginning **without any spaces**. This function returns a `string` by default. You can use `rgb` function as `rgb(92,92,92)` to use custom colors.\n\n**Nested templates** are currently not supported (WIP) so keep in mind that.\n\n### crayon.strip_text(text `string`)\n\nStrip a styled `string` of all the styles returning a pure \u0026 clean `string`\n\n### The Crayon `struct`\n\nThe `template` API uses these same names just without the `()` except for the `rgb` usage.\n\n**Styles:**\n\n`bold()`\n\n`italic()`\n\n`reverse()`\n\n`underline()`\n\n`strikethrough()`\n\n`dim()`\n\n`slow_blink()`\n\n`rapid_blink()`\n\n**Colors:**\n\n*For background colors just put `bg_` before each method*\n\n`black()`\n\n`white()`\n\n`red()`\n\n`green()`\n\n`yellow()`\n\n`blue()`\n\n`magenta()`\n\n`cyan()`\n\n`light_gray()`\n\n`dark_gray()`\n\n`light_red()`\n\n`light_green()`\n\n`light_yellow()`\n\n`light_blue()`\n\n`light_magenta()`\n\n`light_cyan()`\n\n**RGB Support**\n\n`rbg(int,int,int)`\n\n**Other Methods:**\n\n`strip()` Strip the `Crayon` of all styles. Returns a `string`\n\n`len()` Get the actual length of the styled `string`. Same as doing `strip().len()`\n\n`print()`Print the styled `string`to`terminal`.\n\n`print_with(...string)`Print the styled `string` to terminal with some additional `strings`\n\n### Projects Using Crayon:\n1. [thecodrr.boxx](https://github.com/thecodrr/boxx)\n\n### Find this library useful? :heart:\n\nSupport it by joining **[stargazers](https://github.com/thecodrr/crayon/stargazers)** for this repository. :star: or [buy me a cup of coffee](https://ko-fi.com/thecodrr)\nAnd **[follow](https://github.com/thecodrr)** me for my next creations! 🤩\n\n# License\n\n```xml\nCopyright (c) 2019 Abdullah Atta\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodrr%2Fcrayon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodrr%2Fcrayon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodrr%2Fcrayon/lists"}