tests/testthat/test-20-mixtures.R

context("Mixing colours")

test_that("shade objects can be mixed and complements calculated", {
    expect_equivalent(coords(complement("cyan")), coords(shade("red")))
    expect_equal(complement("cyan",space="HSV"), warp("red","HSV"))
    expect_equal(complement("cyan",space="Lab"), "#4F0002", hexonly=TRUE)
    
    expect_equivalent(addmix("blue","green"), shade("#00FFFF"))
    expect_equivalent(submix("cyan","yellow"), shade("#00FF00"))
    expect_equivalent("blue" %.)% "green", shade("#00FFFF"))
    expect_equivalent("cyan" %_/% "yellow", shade("#00FF00"))
})

Try the shades package in your browser

Any scripts or data that you put into this service are public.

shades documentation built on Aug. 2, 2019, 5:05 p.m.