Retrieve a color or set of colors from the COLOURlovers API.
1 2 3
The six-characte hexidemical representation of a single color.
Optionally, a subset of COLOURlovers colors. Allowed values are “new”, “top”, and “random”.
A named list of parameters passed to the API request. Allowed parameters are
A format for the API response, one of “xml” (the default) or “json”. This has essentially no effect on function behavior.
Retrieve details about a color our set of colors.
Specifying named arguments to
... allows the user to request a specific response, as follows:
lover: A character string containing a COLOURlovers username.
hueRange: A two-element numeric vector containing the upper and lower bounds of a hue range. Allowed values are between 0 and 359, exclusive.
briRange: A two-element numeric vector containing the upper and lower bounds of a brightness range. Allowed values are between 0 and 99, exclusive.
keywords: A character string containing one or more keywords to search by.
keywordsExact: A boolean indicating search on keywords should be exact (
TRUE) or not (
FALSE, the API default).
orderCol: A character string containing a sort criterion. One of “dateCreated”, “score”, “name”, “numVotes”, “numViews”.
sortBy: A character string containing either “ASC” (for ascending by the
orderCol criterion, the default) or “DSC” (for descending).
numResults: A numeric value indicating the number of results to return, with a maximum of 100. Default is 20.
resultOffset: A numeric value indicating the page of results to return, with page size specified in the
A list of class “clcolor”. This should be the same regardless of the value of
Thomas J. Leeper
1 2 3 4 5 6 7 8 9 10 11
e <- function(e) NULL # function for tryCatch to fail in examples # get a random color tryCatch( clcolors('random'), error = e) # get a single color tryCatch( clcolor('6B4106'), error = e) # plot a single color clpng co <- tryCatch( clcolor(rgb(0,0,1), fmt='json'), error = e) if(!is.null(co)) plot(co)