{"id":18515282,"url":"https://github.com/chokobole/color","last_synced_at":"2025-09-04T18:20:21.828Z","repository":{"id":143979092,"uuid":"231049660","full_name":"chokobole/color","owner":"chokobole","description":"A C++ utility library for color.  Contents","archived":false,"fork":false,"pushed_at":"2020-01-07T08:33:20.000Z","size":17,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T03:42:58.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chokobole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-31T07:46:53.000Z","updated_at":"2024-06-07T01:48:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"2819ec3a-ae41-49bc-8a99-0311f99715e1","html_url":"https://github.com/chokobole/color","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/chokobole%2Fcolor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokobole%2Fcolor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokobole%2Fcolor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chokobole%2Fcolor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chokobole","download_url":"https://codeload.github.com/chokobole/color/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254150384,"owners_count":22022938,"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-11-06T15:47:13.766Z","updated_at":"2025-05-14T13:31:17.712Z","avatar_url":"https://github.com/chokobole.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Color\n\nA C++ utility library for color.\n\n## Contents\n- [Color](#color)\n  - [Contents](#contents)\n  - [How to use](#how-to-use)\n  - [Usages](#usages)\n    - [Supported colorspace](#supported-colorspace)\n    - [Conversion](#conversion)\n    - [Named Colors](#named-colors)\n    - [Gradients](#gradients)\n      - [Gradient](#gradient)\n      - [StopColor](#stopcolor)\n      - [Gradient::StepMethod](#gradientstepmethod)\n    - [Colormap](#colormap)\n\n## How to use\n\nTo use `color`, add the followings to your `WORKSPACE` file.\n\n```python\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\nhttp_archive(\n    name = \"com_chokobole_color\",\n    sha256 = \"\u003csha256\u003e\",\n    strip_prefix = \"color-\u003ccommit\u003e\",\n    urls = [\n        \"https://github.com/chokobole/color/archive/\u003ccommit\u003e.tar.gz\",\n    ],\n)\n\nload(\"@com_chokobole_base//bazel:base_deps.bzl\", \"base_deps\")\n\nbase_deps()\n\nload(\"@com_chokobole_bazel_utils//:buildifier_deps.bzl\", \"buildifier_deps\")\n\nbuildifier_deps()\n\nload(\"@com_chokobole_bazel_utils//:buildifier_deps_deps.bzl\", \"buildifier_deps_deps\")\n\nbuildifier_deps_deps()\n```\n\nThen, in your `BUILD` files, import and use the rules.\n\n```python\nload(\"@com_chokobole_color//bazel:color_cc.bzl\", \"color_copts\")\n\ncc_binary(\n    name = \"name\",\n    srcs = [...],\n    copts = color_copts(),\n    deps = [\"@com_chokobole_color//:color\"],\n)\n```\n\n## Usages\n\n### Supported colorspace\n\n* `Rgb`\n* `Hsv`\n\n### Conversion\n\n* `Hsv RgbToHsv(const Rgb\u0026 rgb)`\n* `Rgb HsvToRgb(const Hsv\u0026 hsv)`\n\n### Named Colors\n\nThere are already defined named colors listed in [color_values](https://developer.mozilla.org/ko/docs/Web/CSS/color_value). You can use like below.\n\n```c++\ncolor::Rgb rgb = kBlack;\n```\n\n### Gradients\n\n#### Gradient\n\n* `bool Colors(size_t numbers, std::vector\u003cRgb\u003e* colors, StepMethod = STEP_METHOD_RGB) const`\n\n#### StopColor\n\nMembers\n\n* `Rgb color`\n* `double tposition`: Should be inside between 0 and 1.\n\n#### Gradient::StepMethod\n\n* `STEP_METHOD_RGB`: Interpolate between stop colors by RGB step method.\n* `STEP_METHOD_HSV_CW`: Interpolate between stop colors by HSV clock wise step method.\n* `STEP_METHOD_HSV_CCW`: Interpolate between stop colors by HSV counter clock wise step method.\n\n\nFor examples,\n\n```c++\ncolor::Gradient gradient({kBlack, kRed});\nstd::vector\u003ccolor::Rgb\u003e colors;\ngradient.Color(5, \u0026colors);\n```\n\n### Colormap\n\nFor examples,\n\n```c++\ncolor::Colormap colormap;\nstd::vector\u003ccolor::Rgb\u003e colors;\ncolormap.Jet(24, \u0026colors);\n```\n\nMethods\n\n* `bool Jet(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Hsv(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Hot(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Cool(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Spring(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Summer(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Autumn(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Winter(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Bone(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Copper(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Greys(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Greens(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool BlueRed(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool YIGnBu(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool YIOrRd(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool RdBu(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Picnic(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Rainbow(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool RainbowSoft(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Portland(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool BlackBody(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Earth(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Electric(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Alpha(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Viridis(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Inferno(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Magma(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Plasma(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Warm(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Bathymetry(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool CDOM(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Chlorophyll(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Density(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool FreeSurface_Blue(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool FreeSurface_Red(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Oxygen(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Par(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Phase(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Salinity(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Temperature(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Turbidity(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Velocity_Blue(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Velocity_Green(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n* `bool Cubehelix(size_t numbers, std::vector\u003cRgb\u003e* colors) const`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchokobole%2Fcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchokobole%2Fcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchokobole%2Fcolor/lists"}