legocolors
Lego color naming conventions, associated metadata, and mapping functions.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (20.2%) to scientific vocabulary
Keywords
color-palettes
lego
r-package
Last synced: 10 months ago
·
JSON representation
Repository
Lego color naming conventions, associated metadata, and mapping functions.
Basic Info
- Host: GitHub
- Owner: leonawicz
- License: other
- Language: R
- Default Branch: master
- Homepage: https://leonawicz.github.io/legocolors/
- Size: 451 KB
Statistics
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 4
Topics
color-palettes
lego
r-package
Created over 7 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
License
Code of conduct
Codemeta
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%")
```
# legocolors
[](https://www.repostatus.org/)
[](https://github.com/leonawicz/legocolors/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/leonawicz/legocolors)
[](https://CRAN.R-project.org/package=legocolors)
[](https://cran.r-project.org/package=legocolors)
[](https://github.com/leonawicz/legocolors)
`legocolors` provides a dataset containing several Lego color naming conventions established by various popular sources. It also provides functions for mapping between these color naming conventions as well as between Lego color names, hex colors, and R color names.
By default, nearest colors are computed based on distance in RGB space when an exact match is not found. This behavior supports the purpose of exchanging arbitrary colors for known Lego colors when the goal is to actually acquire and build something out of Lego parts. This focus is also one of the reasons `legocolors` uses BrickLink color names as the default naming convention. See `?legocolor` for details.
## Installation
Install the CRAN release of `legocolors` with
```r
install.packages("legocolors")
```
Install the development version from GitHub with
```r
# install.packages("remotes")
remotes::install_github("leonawicz/legocolors")
```
## Palette conversions
The key helper functions are `hex_to_legocolor()` and `legocolor_to_hex()`. `hex_to_color()` is also provided for general convenience.
```{r example}
library(legocolors)
hex_to_color(c("#ff0000", "#ff0001"))
hex_to_legocolor("#ff0000")
hex_to_legocolor("#ff0000", material = "solid")
legocolor_to_hex("Red")
hex_to_color(legocolor_to_hex("Red"))
x <- topo.colors(10)
hex_to_legocolor(x)
hex_to_legocolor(x, material = "solid")
hex_to_legocolor(x, def = "tlg", material = "solid")
```
While different sets of Lego colors are organized by `material` type, e.g., solid colors, semi-transparent colors, etc., these palettes are not useful for plotting data. The greatest value comes from converting useful color palettes to those comprised of existing Lego colors while still keeping as close to the original palette as possible.
## Palette preview
The `view_legopal` function can be used to quickly see a Lego color palette. It can plot a named `material` palette, but like the functions above, it can also display a converted palette if given an arbitrary vector of hex color values.
```{r plot}
view_legopal("solid")
r <- rainbow(9)
r
view_legopal(r, material = "solid", show_labels = TRUE, label_size = 0.7)
```
## Recommended colors
Dealing with
* Available colors for generic bricks and plates but prohibitively expensive.
* Available colors for generic bricks and plates but with low supply.
* Colors used only for exotic/specialty parts (not available for bricks and plates).
Filtering to a decent set of Lego colors that are relatively easy to acquire online at BrickLink.com for simple brick and/or plate parts, and relatively affordable, is largely the responsibility of the user. There is a `recommended` column in the `legoCols` dataset. However, a human-derived recommendation column would be better (feel free to submit a PR if you'd like to improve the package).
In the previous version of `legocolors`, brick- and plate- specific data, excluding more exotic parts, was scraped from the website catalog, but this has become too difficult to do reliably. For now, you will have to use your personal Lego knowledge to filter out irrelevant or problematic colors from the complete official set. This is worth considering because even though BrickLink consistently offers the widest selection and greatest quantity at the lowest price, supply and demand leads to some parts in some colors being prohibitively expensive to acquire in quantity. When determining what colors you wish to use to build a physical model, you will save an incredible amount of money if you can accept limiting your palette to the most common Lego colors.
## Citation
Matthew Leonawicz (`r substr(Sys.Date(), 1, 4)`). legocolors: Official Lego Color Palettes. R package version 0.4.0. https://CRAN.R-project.org/package=legocolors
## Contribute
Contributions are welcome. Contribute through GitHub via pull request. Please create an issue first if it is regarding any substantive feature add or change.
---
Please note that the `legocolors` project is released with a [Contributor Code of Conduct](https://leonawicz.github.io/legocolors/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Owner
- Name: Matt Leonawicz
- Login: leonawicz
- Kind: user
- Location: Denver, Colorado, USA
- Repositories: 89
- Profile: https://github.com/leonawicz
R and Shiny developer | Software developer @ropensci @r-music
CodeMeta (codemeta.json)
{
"@context": [
"https://doi.org/10.5063/schema/codemeta-2.0",
"http://schema.org"
],
"@type": "SoftwareSourceCode",
"identifier": "legocolors",
"description": "Provides a dataset containing several color naming conventions established by multiple sources, along with associated color metadata.\n The package also provides related helper functions for mapping among the different Lego color naming conventions and between Lego colors, hex colors, and 'R' color names, \n making it easy to convert any color palette to one based on existing Lego colors while keeping as close to the original color palette as possible.\n The functions use nearest color matching based on Euclidean distance in RGB space. \n Naming conventions for color mapping include those from 'BrickLink' (<https://www.bricklink.com>), 'The Lego Group' (<https://www.lego.com>), 'LDraw' (<https://www.ldraw.org/>), and 'Peeron' (<http://www.peeron.com/>).",
"name": "legocolors: Official Lego Color Palettes",
"codeRepository": "https://github.com/leonawicz/legocolors",
"issueTracker": "https://github.com/leonawicz/legocolors/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.3.2",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.0.5 (2021-03-31)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"author": [
{
"@type": "Person",
"givenName": "Matthew",
"familyName": "Leonawicz",
"email": "mfleonawicz@gmail.com"
}
],
"contributor": {},
"copyrightHolder": {},
"funder": {},
"maintainer": [
{
"@type": "Person",
"givenName": "Matthew",
"familyName": "Leonawicz",
"email": "mfleonawicz@gmail.com"
}
],
"softwareSuggestions": [
{
"@type": "SoftwareApplication",
"identifier": "testthat",
"name": "testthat",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=testthat"
},
{
"@type": "SoftwareApplication",
"identifier": "covr",
"name": "covr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=covr"
}
],
"softwareRequirements": [
{
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 2.10"
}
],
"releaseNotes": "https://github.com/leonawicz/legocolors/blob/master/NEWS.md",
"readme": "https://github.com/leonawicz/legocolors/blob/master/README.md",
"fileSize": "548.497KB",
"contIntegration": [
"https://travis-ci.org/leonawicz/legocolors",
"https://ci.appveyor.com/project/leonawicz/legocolors",
"https://codecov.io/gh/leonawicz/legocolors?branch=master"
],
"developmentStatus": "https://www.repostatus.org/",
"relatedLink": "https://CRAN.R-project.org/package=legocolors",
"keywords": [
"r-package",
"lego",
"color-palettes"
]
}
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: about 3 years ago
All Time
- Total Commits: 39
- Total Committers: 1
- Avg Commits per committer: 39.0
- Development Distribution Score (DDS): 0.0
Top Committers
| Name | Commits | |
|---|---|---|
| Matthew Leonawicz | m****z@e****m | 39 |
Committer Domains (Top 20 + Academic)
esource.com: 1
Issues and Pull Requests
Last synced: over 2 years ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: 20 days
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 1.5
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rcorty (1)
- leonawicz (1)
Pull Request Authors
Top Labels
Issue Labels
help wanted (1)
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 222 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: legocolors
Official Lego Color Palettes
- Homepage: https://github.com/leonawicz/legocolors
- Documentation: http://cran.r-project.org/web/packages/legocolors/legocolors.pdf
- License: MIT + file LICENSE
-
Latest release: 0.4.0
published almost 2 years ago
Rankings
Stargazers count: 24.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 37.9%
Downloads: 71.1%
Maintainers (1)
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- covr * suggests
- testthat * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite