maximize_contrast: Finds the highest contrast color available for those...

Description Usage Arguments Value Examples

Description

Finds the highest contrast color available for those specified by the user. Uses gradient-descent optimization on the "contrast" function.

Usage

1
2
maximize_contrast(..., maxrep = 10, maxit = 100, h = 1e-08,
  output = "hex")

Arguments

...

All the colors of interest. Hexcode, c(r,g,b), color name as character and "color" class object are all supported.

maxrep

Number of times the process of local optimization will be repeated. Defaults to 10

maxit

Number of iterations for each gradient descent optimization (finding of local minimum). Defaults to 100

h

Step used to calculate the gradient of the contrast function. Defaults to 1e-8

Value

Either a hexcode or class "color" object with highest contrast with those inputted.

Examples

1
2
3
maximize_contrast("green")
maximize_contrast("yellow", "red")
maximize_contrast(list("yellow", "red", c(0,255,0)))

dpcarballo/coloR documentation built on June 1, 2019, 8:14 p.m.