knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

library(emo)

dmc

Travis build status Codecov test coverage Lifecycle: experimental

The goal of dmc is to allow you to find the closest DMC embroidery floss colour(s) for a given colour, as well as access colour (hex, RGB) information about DMC colours.

If you'd like to use dmc without having to install the package (or R!), there is a Shiny app as well (in its own package, dmcapp).

Installation

You can install the development version of dmc from github with:

# install.packages(devtools)
devtools::install_github("sharlagelfand/dmc")

Example

Say I'm interested in finding the closest DMC floss colour for the background colour of the dplyr package's hex logo r emo::ji("smiling_imp").

I can look up the hex code for this colour via a site like HTML Color Codes. The hex code is "#EE8726".

Then, I can use dmc() to find the closest DMC floss for this colour:

library(dmc)

dplyr_background <- "#EE8726"

dmc(dplyr_background)

I can choose to show more than one matching colour:

dmc(dplyr_background, n = 3)

And to turn off the visualization of the colours:

dmc(dplyr_background, visualize = FALSE)

By default, dmc() uses Euclidean distance to find the closest floss colour. The method can be changed to be one of "euclidean", "cie1976", "cie94", "cie2000", or "cmc". For example:

dmc(dplyr_background, n = 3, method = "cie94")

If I want to go the other way and just find the hex/RGB information for a given DMC floss, I can use undmc(). By default, this visualizes the DMC floss:

undmc(c("Ecru", "B5200"))

Again, the visualization can be turned off:

undmc(310, visualize = FALSE)

undmc() mostly just takes the DMC floss number, except in cases where there isn't one (e.g., Ecru).

A full list of floss colours in the package is available via floss:

floss

where the values in floss[["dmc"]] are all that can be passed to undmc().



sharlagelfand/dmc documentation built on March 3, 2020, 9:15 a.m.