{"id":13813793,"url":"https://github.com/mazznoer/colorgrad","last_synced_at":"2026-02-01T08:14:00.343Z","repository":{"id":49806680,"uuid":"282250117","full_name":"mazznoer/colorgrad","owner":"mazznoer","description":"Go (Golang) color scales library for maps, charts, data-visualization \u0026 creative coding.","archived":false,"fork":false,"pushed_at":"2026-01-01T02:20:02.000Z","size":815,"stargazers_count":228,"open_issues_count":0,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-01T04:51:47.674Z","etag":null,"topics":["color","color-scales","colormap","data-visualization","gradient","visual-encoding","visualization"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mazznoer.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":{"ko_fi":"mazznoer","liberapay":"mazznoer","custom":"https://paypal.me/mazznoer"}},"created_at":"2020-07-24T15:07:19.000Z","updated_at":"2026-01-01T02:08:12.000Z","dependencies_parsed_at":"2024-06-18T15:15:35.000Z","dependency_job_id":"dba4021b-3a12-4a3c-8342-7d637343f91f","html_url":"https://github.com/mazznoer/colorgrad","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/mazznoer/colorgrad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazznoer%2Fcolorgrad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazznoer%2Fcolorgrad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazznoer%2Fcolorgrad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazznoer%2Fcolorgrad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mazznoer","download_url":"https://codeload.github.com/mazznoer/colorgrad/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazznoer%2Fcolorgrad/sbom","scorecard":{"id":630649,"data":{"date":"2025-08-11","repo":{"name":"github.com/mazznoer/colorgrad","commit":"b89625ca2d00169feea3d43d6fed1432e7c76204"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/mazznoer/colorgrad/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/mazznoer/colorgrad/go.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T07:49:31.232Z","repository_id":49806680,"created_at":"2025-08-21T07:49:31.232Z","updated_at":"2025-08-21T07:49:31.232Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28973365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T06:46:42.625Z","status":"ssl_error","status_checked_at":"2026-02-01T06:44:56.173Z","response_time":56,"last_error":"SSL_read: 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":["color","color-scales","colormap","data-visualization","gradient","visual-encoding","visualization"],"created_at":"2024-08-04T04:01:30.809Z","updated_at":"2026-02-01T08:14:00.335Z","avatar_url":"https://github.com/mazznoer.png","language":"Go","funding_links":["https://ko-fi.com/mazznoer","https://liberapay.com/mazznoer","https://paypal.me/mazznoer","https://liberapay.com/mazznoer/donate"],"categories":["Go"],"sub_categories":[],"readme":"# colorgrad\n\n[![Release](https://img.shields.io/github/release/mazznoer/colorgrad.svg)](https://github.com/mazznoer/colorgrad/releases/latest)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/mazznoer/colorgrad)](https://pkg.go.dev/github.com/mazznoer/colorgrad)\n![Build Status](https://github.com/mazznoer/colorgrad/actions/workflows/go.yml/badge.svg)\n[![go report](https://goreportcard.com/badge/github.com/mazznoer/colorgrad)](https://goreportcard.com/report/github.com/mazznoer/colorgrad)\n\nGo (Golang) _color scales_ library for data visualization, charts, games, maps, generative art and others.\n\n## Support This Project\n\n[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/mazznoer/donate)\n\n## Index\n\n* [Custom Gradient](#custom-gradient)\n* [Preset Gradients](#preset-gradients)\n* [Using the Gradient](#using-the-gradient)\n* [Examples](#examples)\n* [Playground](#playground)\n\n```go\nimport \"github.com/mazznoer/colorgrad\"\n```\n\n## Custom Gradient\n\n### Basic\n\n```go\ngrad, err := colorgrad.NewGradient().Build()\n```\n![img](doc/images/custom-default.png)\n\n### Custom Colors\n\n```go\ngrad, err := colorgrad.NewGradient().\n    Colors(\n        colorgrad.Rgb8(0, 206, 209, 255),\n        colorgrad.Rgb8(255, 105, 180, 255),\n        colorgrad.Rgb(0.274, 0.5, 0.7, 1),\n        colorgrad.Hsv(50, 1, 1, 1),\n        colorgrad.Hsv(348, 0.9, 0.8, 1),\n    ).\n    Build()\n```\n![img](doc/images/custom-colors.png)\n\n### Using Web Color Format\n\n`HtmlColors()` method accepts [named colors](https://www.w3.org/TR/css-color-4/#named-colors), hexadecimal (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`), `rgb()`, `rgba()`, `hsl()`, `hsla()`, `hwb()`, and `hsv()`.\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"#C41189\", \"#00BFFF\", \"#FFD700\").\n    Build()\n```\n![img](doc/images/custom-hex-colors.png)\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"gold\", \"hotpink\", \"darkturquoise\").\n    Build()\n```\n![img](doc/images/custom-named-colors.png)\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\n        \"rgb(125,110,221)\",\n        \"rgb(90%,45%,97%)\",\n        \"hsl(229,79%,85%)\",\n    ).\n    Build()\n```\n![img](doc/images/custom-css-colors.png)\n\n### Domain \u0026 Color Position\n\nDefault domain is [0..1].\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"deeppink\", \"gold\", \"seagreen\").\n    Build()\n```\n![img](https://raw.githubusercontent.com/mazznoer/colorgrad-rs/master/docs/images/domain-default.png)\n\nSet the domain to [0..100].\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"deeppink\", \"gold\", \"seagreen\").\n    Domain(0, 100).\n    Build()\n```\n![img](https://raw.githubusercontent.com/mazznoer/colorgrad-rs/master/docs/images/domain-100.png)\n\nSet the domain to [-1..1].\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"deeppink\", \"gold\", \"seagreen\").\n    Domain(-1, 1).\n    Build()\n```\n![img](https://raw.githubusercontent.com/mazznoer/colorgrad-rs/master/docs/images/domain-neg1-1.png)\n\nSet exact position for each color. The domain is [0..1].\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"deeppink\", \"gold\", \"seagreen\").\n    Domain(0, 0.7, 1).\n    Build()\n```\n![img](https://raw.githubusercontent.com/mazznoer/colorgrad-rs/master/docs/images/color-position-1.png)\n\nSet exact position for each color. The domain is [15..80].\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"deeppink\", \"gold\", \"seagreen\").\n    Domain(15, 30, 80).\n    Build()\n```\n![img](https://raw.githubusercontent.com/mazznoer/colorgrad-rs/master/docs/images/color-position-2.png)\n\n### CSS Gradient Format\n\n```go\ngrad, err := colorgrad.NewGradient().\n    Css(\"deeppink, gold, seagreen\").\n    Build()\n```\n![img](doc/images/css-gradient-1.png)\n\n```go\ngrad, err := colorgrad.NewGradient().\n    Css(\"purple, gold 35%, green 35%, 55%, gold\").\n    Interpolation(colorgrad.InterpolationCatmullRom).\n    Build()\n```\n![img](doc/images/css-gradient-2.png)\n\n### Blending Mode\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"#FFF\", \"#00F\").\n    Mode(colorgrad.BlendRgb).\n    Build()\n```\n![blend-modes](doc/images/blend-modes-3.png)\n\n### Interpolation Mode\n\n```go\ngrad, err := colorgrad.NewGradient().\n    HtmlColors(\"#C41189\", \"#00BFFF\", \"#FFD700\").\n    Interpolation(colorgrad.InterpolationLinear).\n    Build()\n```\n\n`InterpolationLinear`\n![interpolation-linear](doc/images/interpolation-linear2.png)\n\n`InterpolationSmoothstep`\n![interpolation-smoothstep](doc/images/interpolation-smoothstep.png)\n\n`InterpolationCatmullRom`\n![interpolation-catmull-rom](doc/images/interpolation-catmull-rom2.png)\n\n`InterpolationBasis`\n![interpolation-basis](doc/images/interpolation-basis2.png)\n\n## Preset Gradients\n\nSee [PRESET.md](PRESET.md)\n\n## Parsing GIMP Gradient\n\n```go\nimport \"os\"\n\nforeground := colorgrad.Rgb(0, 0, 0, 1)\nbackground := colorgrad.Rgb(1, 1, 1, 1)\nfile, err := os.Open(\"Abstract_1.ggr\")\n\nif err != nil {\n\tpanic(err)\n}\n\ndefer file.Close()\ngrad, name, err2 := colorgrad.ParseGgr(file, foreground, background)\nfmt.Println(name) // Abstract 1\n```\n\n![gimp-gradient](doc/images/ggr-abstract-1.png)\n\n## Using the Gradient\n\n### Get the domain\n\n```go\ngrad := colorgrad.Rainbow()\n\nfmt.Println(grad.Domain()) // 0 1\n```\n\n### Get single color at certain position\n\n```go\ngrad := colorgrad.Rainbow()\n\nfmt.Println(grad.At(0.0).HexString()) // #6e40aa\nfmt.Println(grad.At(0.5).HexString()) // #aff05b\nfmt.Println(grad.At(1.0).HexString()) // #6e40aa\n```\n\n### Get n colors evenly spaced across gradient\n\n```go\ngrad := colorgrad.Rainbow()\n\nfor _, c := range grad.Colors(10) {\n    fmt.Println(c.HexString())\n}\n```\n\nOutput:\n\n```console\n#6e40aa\n#c83dac\n#ff5375\n#ff8c38\n#c9d33a\n#7cf659\n#5dea8d\n#48b8d0\n#4775de\n#6e40aa\n```\n\n### Hard-Edged Gradient\n\nConvert gradient to hard-edged gradient with 11 segments and 0 smoothness.\n\n```go\ngrad := colorgrad.Rainbow().Sharp(11, 0)\n```\n![img](doc/images/rainbow-sharp.png)\n\nThis is the effect of different smoothness.\n\n![img](doc/images/sharp-gradients.png)\n\n## Examples\n\n### Gradient Image\n\n```go\npackage main\n\nimport (\n    \"image\"\n    \"image/png\"\n    \"os\"\n\n    \"github.com/mazznoer/colorgrad\"\n)\n\nfunc main() {\n    grad, _ := colorgrad.NewGradient().\n        HtmlColors(\"#C41189\", \"#00BFFF\", \"#FFD700\").\n        Build()\n\n    w := 1500\n    h := 70\n    fw := float64(w)\n\n    img := image.NewRGBA(image.Rect(0, 0, w, h))\n\n    for x := 0; x \u003c w; x++ {\n        col := grad.At(float64(x) / fw)\n        for y := 0; y \u003c h; y++ {\n            img.Set(x, y, col)\n        }\n    }\n\n    file, err := os.Create(\"gradient.png\")\n    if err != nil {\n        panic(err.Error())\n    }\n    defer file.Close()\n    png.Encode(file, img)\n}\n```\n\nExample output:\n\n![img](doc/images/custom-hex-colors.png)\n\n### Colored Noise\n\n```go\npackage main\n\nimport (\n    \"image\"\n    \"image/png\"\n    \"os\"\n\n    \"github.com/mazznoer/colorgrad\"\n    \"github.com/ojrac/opensimplex-go\"\n)\n\nfunc main() {\n    w := 600\n    h := 350\n    scale := 0.02\n\n    grad := colorgrad.Rainbow().Sharp(7, 0.2)\n    noise := opensimplex.NewNormalized(996)\n    img := image.NewRGBA(image.Rect(0, 0, w, h))\n\n    for y := 0; y \u003c h; y++ {\n        for x := 0; x \u003c w; x++ {\n            t := noise.Eval2(float64(x)*scale, float64(y)*scale)\n            img.Set(x, y, grad.At(t))\n        }\n    }\n\n    file, err := os.Create(\"noise.png\")\n    if err != nil {\n        panic(err.Error())\n    }\n    defer file.Close()\n    png.Encode(file, img)\n}\n```\n\nExample output:\n\n![noise](doc/images/noise.png)\n\n## Playground\n\n* [Basic](https://play.golang.org/p/PlMov8BKfRc)\n* [Random colors](https://play.golang.org/p/d67x9di4sAF)\n\n## Dependencies\n\n* [csscolorparser](https://github.com/mazznoer/csscolorparser)\n\n## Inspirations\n\n* [chroma.js](https://gka.github.io/chroma.js/#color-scales)\n* [d3-scale-chromatic](https://github.com/d3/d3-scale-chromatic/)\n* colorful's [gradientgen.go](https://github.com/lucasb-eyer/go-colorful/blob/master/doc/gradientgen/gradientgen.go)\n\n## Links\n\n* [colorgrad-rs](https://github.com/mazznoer/colorgrad-rs) - Rust port of this library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazznoer%2Fcolorgrad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazznoer%2Fcolorgrad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazznoer%2Fcolorgrad/lists"}