Retrieve a color or set of colors from the COLOURlovers API.
clcolors(set = NULL, ..., fmt = "xml")clcolor(hex, fmt = "xml")
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 lover, hueRange, briRange,
keywords, keywordExact, orderCol, sortBy,
numResults, and resultOffset. Specifying orderCol
overrules any argument to set. See details.
A format for the API response, one of “xml” (the default)
or “json”. This has essentially no effect on function behavior.
@return A list of class “clcolor”. This should be the same regardless
of the value of fmt.
The six-character hexidemical representation of a single color.
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.
keywordExact: 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 numResults argument.
# NOT RUN {
# Get a random color
clcolors('random')
# Get a single color
clcolor('6B4106')
# Plot a single color
clcolor(rgb(0,0,1), fmt = 'json')
# }
Run the code above in your browser using DataLab