{"id":28631478,"url":"https://github.com/dreamrs/colorscale","last_synced_at":"2025-10-04T04:56:52.168Z","repository":{"id":95092409,"uuid":"146331276","full_name":"dreamRs/colorscale","owner":"dreamRs","description":"Create a color scale from a single color","archived":false,"fork":false,"pushed_at":"2020-04-16T15:11:43.000Z","size":101,"stargazers_count":78,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-13T21:40:25.885Z","etag":null,"topics":["addin","color","color-scale","r","rstudio-addin","shiny"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dreamRs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-08-27T17:28:19.000Z","updated_at":"2024-11-20T16:50:39.000Z","dependencies_parsed_at":"2023-03-13T16:53:58.744Z","dependency_job_id":null,"html_url":"https://github.com/dreamRs/colorscale","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dreamRs/colorscale","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamRs%2Fcolorscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamRs%2Fcolorscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamRs%2Fcolorscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamRs%2Fcolorscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dreamRs","download_url":"https://codeload.github.com/dreamRs/colorscale/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamRs%2Fcolorscale/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278266895,"owners_count":25958733,"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-10-04T02:00:05.491Z","response_time":63,"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":["addin","color","color-scale","r","rstudio-addin","shiny"],"created_at":"2025-06-12T13:31:09.524Z","updated_at":"2025-10-04T04:56:52.164Z","avatar_url":"https://github.com/dreamRs.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# colorscale\n\n\u003e R6 api for [chroma.js](https://github.com/gka/chroma.js) \u0026 an RStudio add-in to create a color scale from a single color.\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![R build status](https://github.com/dreamRs/colorscale/workflows/R-CMD-check/badge.svg)](https://github.com/dreamRs/colorscale/actions)\n[![Travis build status](https://travis-ci.com/dreamRs/colorscale.svg?branch=master)](https://travis-ci.com/dreamRs/colorscale)\n\u003c!-- badges: end --\u003e\n\n\n## Installation\n\nInstall development version from GitHub with:\n\n``` r\nremotes::install_github(\"dreamRs/colorscale\")\n```\n\n\n## RStudio add-in\n\nAn add-in to create a color palette from a single color (largely inspired by https://github.com/hihayk/scale).\n\nTo launch the gadget use the \"Addins\" menu in RStudio or: \n\n```r\ncolorscale::addin_color_scale()\n```\n\n![](man/figures/addin-onecolor.png)\n\n\n## chroma.js API\n\nCreate a R6 class to access chroma.js methods:\n\n```r\nlibrary(colorscale)\n\nch \u003c- chroma$new(\"hotpink\")\nch$darken(2)\nch$eval()\n#\u003e [1] \"#930058\"\n\nhsl \u003c- chroma$new()\nhsl$chroma.hsl(330, 1, 0.6)\nview_cols(hsl$eval())\nhsl$darken(seq(0.2, 3, 0.2))\nview_cols(hsl$eval())\n```\n\n\nSome methods have wrapper for easier use:\n\n```r\n# Mixes two colors\nchroma_mix(color1 = \"red\", color2 = \"blue\")\n#\u003e [1] \"#800080\"\n\n# Average between colors\nchroma_avg(colors = c(\"#ddd\", \"yellow\", \"red\", \"teal\"))\n#\u003e [1] \"#b79757\"\n\n# Random colors\nchroma_random()\n#\u003e [1] \"#650a0c\"\nchroma_random(10)\n#\u003e [1] \"#63e24b\" \"#909363\" \"#5a3d7d\" \"#41a505\" \"#8f5f13\" \"#df6535\" \"#da43d3\" \"#04fc8f\" \"#6ee31c\" \"#ac5c94\"\n\n# Euclidean distance between two colors\nchroma_distance(\"#fff\", \"#ff0\")\n#\u003e [1] 96.94758\nchroma_distance(\"#fff\", \"#ff0\", \"rgb\")\n#\u003e [1] 255\n```\n\nConvert color to specific color space:\n\n```r\nch \u003c- chroma$new(\"orange\")\nch$hex()\n#\u003e [1] \"#ffa500\"\nch$rgb()\n#\u003e [1] 255 165   0\nch$hsl()\n#\u003e [1] 38.82353  1.00000  0.50000\nch$lab()\n#\u003e [1] 74.93565 23.93317 78.94978\nch$gl()\n#\u003e [1] 1.0000000 0.6470588 0.0000000 1.0000000\nch$css()\n#\u003e [1] \"rgb(255,165,0)\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamrs%2Fcolorscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdreamrs%2Fcolorscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamrs%2Fcolorscale/lists"}