{"id":22294628,"url":"https://github.com/whiteleaf7/termcolorlight","last_synced_at":"2025-03-25T22:20:52.973Z","repository":{"id":20432409,"uuid":"23709098","full_name":"whiteleaf7/termcolorlight","owner":"whiteleaf7","description":"lightweight version of TermColor","archived":false,"fork":false,"pushed_at":"2014-10-02T17:22:14.000Z","size":232,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-30T03:02:53.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"martynsmith/node-irc","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whiteleaf7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-05T15:58:28.000Z","updated_at":"2019-02-25T08:07:54.000Z","dependencies_parsed_at":"2022-09-10T21:21:43.375Z","dependency_job_id":null,"html_url":"https://github.com/whiteleaf7/termcolorlight","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/whiteleaf7%2Ftermcolorlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteleaf7%2Ftermcolorlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteleaf7%2Ftermcolorlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteleaf7%2Ftermcolorlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whiteleaf7","download_url":"https://codeload.github.com/whiteleaf7/termcolorlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245550684,"owners_count":20633883,"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":[],"created_at":"2024-12-03T17:37:56.122Z","updated_at":"2025-03-25T22:20:52.944Z","avatar_url":"https://github.com/whiteleaf7.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TermColorLight\n\nThis gem is library that convert color tags (e.g. `\u003cred\u003estr\u003c/red\u003e` ) to\nansicolor(vt100 escape sequence). And this's lightweight version of\nTermColor.gem without other gems. In addition process spedd is surprisingly fast.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'termcolorlight'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install termcolorlight\n\n## Usage\n\n```ruby\nrequire \"termcolorlight\"\n\nTermColorLight.parse(\"\u003cred\u003estrings\u003c/red\u003e\")  # =\u003e \\e[31mstrings\\e[0m\n\"\u003cred\u003estrings\u003c/red\u003e\".termcolor  # a ditto\n\nstr = \"\u003cdiv\u003econtainer\u003c/div\u003e\"\n\"\u003cbold\u003e\u003cgreen\u003e#{str.escape}\u003c/green\u003e\u003c/bold\u003e\".termcolor  # =\u003e \\e[1m\\e[32m\u003cdiv\u003econtainer\u003c/div\u003e\\e[0m\\e[1m\\e[0m\n```\n\n```ruby\nrequire \"termcolorlight/html\"\nstr = \"\u003cdiv\u003econtainer\u003c/div\u003e\"\nTermColorLight.to_html(\"\u003cbold\u003e\u003cgreen\u003e#{str.escape}\u003c/green\u003e\u003c/bold\u003e\")\n# =\u003e \u003cspan style=\"font-weight:bold\"\u003e\u003cspan style=\"color:lime\"\u003e\u0026lt;div\u0026gt;container\u0026lt;/div\u0026gt;\u003c/span\u003e\u003c/span\u003e\n```\n\n![HTML ScreenCapture](html_ss.png)\n\nYou can use the following tags.\n\n```\n# forground tags\nblack, red, green, yellow, blue, magenta, cyan, white, gray\n\n# background tags\non_black, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white, on_gray\n\n# decorations\nbold, dark, underline, underscore, blink, reverse, concealed\n```\n\n## Benchmark\n\n### Code\n\n```ruby\nrequire \"termcolor\"\nrequire \"termcolorlight\"\nrequire \"benchmark\"\n\nn = 100000\nBenchmark.bm(20) do |bm|\n  bm.report \"TermColor.parse\" do\n    n.times do\n      TermColor.parse(\"\u003cred\u003ered\u003c/red\u003e\")\n    end\n  end\n  bm.report \"TermColorLight.parse\" do\n    n.times do\n      TermColorLight.parse(\"\u003cred\u003ered\u003c/red\u003e\")\n    end\n  end\nend\n```\n\n### Results\n\n\u003e Performed by OSX. \n\nUse ruby 2.0.0p451\n\n```\n                           user     system      total        real\nTermColor.parse       13.770000   5.830000  19.600000 ( 19.595587)\nTermColorLight.parse   2.880000   0.010000   2.890000 (  2.899383)\n```\n\nYou could see that processing speed of TermColorLight is much faster\nthan TermColor's one.\n\nUse ruby 2.2.0 (2014-08-20 trunk 47225 [x86_64-darwin13])\n\n```\n                           user     system      total        real\nTermColor.parse       12.960000   4.720000  17.680000 ( 17.674688)\nTermColorLight.parse   0.850000   0.000000   0.850000 (  0.853439)\n```\n\nOops...\n\n## Changelogs\n\n### version 1.1.0 (2014/10/03)\n\n+ add a method **TermColorLight.to_html**\n\t- Perfect emuration of terminal\n\n## Contributing\n\n1. Fork it ( https://github.com/whiteleaf7/termcolorlight/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteleaf7%2Ftermcolorlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhiteleaf7%2Ftermcolorlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteleaf7%2Ftermcolorlight/lists"}