{"id":14008141,"url":"https://github.com/tomnomnom/xtermcolor","last_synced_at":"2025-08-03T04:33:12.765Z","repository":{"id":19667530,"uuid":"22920963","full_name":"tomnomnom/xtermcolor","owner":"tomnomnom","description":"Golang package and command to convert color.Colour to the nearest xterm/bash/shell color","archived":false,"fork":false,"pushed_at":"2016-04-28T12:47:13.000Z","size":18,"stargazers_count":25,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T03:24:46.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/tomnomnom.png","metadata":{"files":{"readme":"README.mkd","changelog":"CHANGELOG.mkd","contributing":"CONTRIBUTING.mkd","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-13T15:38:01.000Z","updated_at":"2025-02-06T04:43:54.000Z","dependencies_parsed_at":"2022-08-24T14:07:38.833Z","dependency_job_id":null,"html_url":"https://github.com/tomnomnom/xtermcolor","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tomnomnom/xtermcolor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fxtermcolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fxtermcolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fxtermcolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fxtermcolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomnomnom","download_url":"https://codeload.github.com/tomnomnom/xtermcolor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fxtermcolor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268495878,"owners_count":24259395,"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-03T02:00:12.545Z","response_time":2577,"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":"2024-08-10T11:01:17.103Z","updated_at":"2025-08-03T04:33:12.730Z","avatar_url":"https://github.com/tomnomnom.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# XtermColor\n\nFind the closest xterm color to anything implementing [color.Color](https://golang.org/pkg/image/color/#Color).\n\nProvides a [color.Palette](https://golang.org/pkg/image/color/#Palette) as `xtermcolor.Colors` so you can use `.Convert` and `.Index`,\nbut also provides convenience functions to get the index as a `uint8` from a `color.Color`, a 32 bit integer, or a 24 bit hex string.\n\n[![Build Status](https://travis-ci.org/tomnomnom/xtermcolor.svg?branch=master)](https://travis-ci.org/tomnomnom/xtermcolor)\n\n\nFull documentation can be found on [GoDoc](https://godoc.org/github.com/tomnomnom/xtermcolor).\n\nBasic usage (examples/basic.go):\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"image/color\"\n\n\t\"github.com/tomnomnom/xtermcolor\"\n)\n\nfunc main() {\n\tfmt.Println(xtermcolor.Colors.Convert(color.RGBA{128, 64, 32, 255}))\n\n\tfmt.Println(xtermcolor.FromColor(color.RGBA{120, 210, 120, 255}))\n\n\tfmt.Println(xtermcolor.FromInt(0xCC66FFFF))\n\n\tcode, err := xtermcolor.FromHexStr(\"#FEFEFE\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tfmt.Println(code)\n}\n```\n\n```\n▶ go run examples/basic.go \n{135 95 0 255}\n114\n171\n15\n```\n\n## xtermcolor command\n\nThere's also an `xtermcolor` command you can install by running:\n\n```\n▶ go get github.com/tomnomnom/xtermcolor/cmd/xtermcolor\n```\n\nOr you can download a binary from the [releases page](https://github.com/tomnomnom/xtermcolor/releases).\n\nThe command returns the color code for a 24 bit hex number:\n\n```\n▶ xtermcolor cc66ff\n171\n```\n\n...or for seperate 8 bit red, green and blue components:\n\n```\n▶ xtermcolor 210 128 0\n172\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomnomnom%2Fxtermcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomnomnom%2Fxtermcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomnomnom%2Fxtermcolor/lists"}