File: colourWidget.Rd

package info (click to toggle)
r-cran-colourpicker 1.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,548 kB
  • sloc: javascript: 1,490; makefile: 13; sh: 3
file content (64 lines) | stat: -rw-r--r-- 2,339 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/colourWidget.R
\name{colourWidget}
\alias{colourWidget}
\title{Create a colour picker htmlwidget}
\usage{
colourWidget(
  value = "white",
  showColour = c("both", "text", "background"),
  palette = c("square", "limited"),
  allowedCols = NULL,
  allowTransparent = FALSE,
  returnName = FALSE,
  closeOnClick = FALSE,
  width = "300px",
  height = "35px",
  elementId = NULL
)
}
\arguments{
\item{value}{Initial value (can be a colour name or HEX code)}

\item{showColour}{Whether to show the chosen colour as text inside the input,
as the background colour of the input, or both (default).}

\item{palette}{The type of colour palette to allow the user to select colours
from. \code{square} (default) shows a square colour palette that allows the
user to choose any colour, while \code{limited} only gives the user a
predefined list of colours to choose from.}

\item{allowedCols}{A list of colours that the user can choose from. Only
applicable when \code{palette == "limited"}. The \code{limited} palette
uses a default list of 40 colours if \code{allowedCols} is not defined. If
the colour specified in \code{value} is not in the list, the default colour
will revert to black.}

\item{allowTransparent}{If \code{TRUE}, enables a slider to choose an alpha
(transparency) value for the colour. When a colour with opacity is
chosen, the return value is an 8-digit HEX code.}

\item{returnName}{If \code{TRUE}, then return the name of an R colour instead
of a HEX value when possible.}

\item{closeOnClick}{If \code{TRUE}, then the colour selection panel will close
immediately after selecting a colour.}

\item{width}{Custom width for the input field.}

\item{height}{Custom height for the input field.}

\item{elementId}{Use an explicit element ID for the widget (rather than an
automatically generated one).}
}
\description{
Create a colour picker htmlwidget. This is not terribly useful right now
since you can use the more powerful \code{\link[colourpicker]{colourInput}}
in Shiny apps and Rmarkdown documents, but this gives you an htmlwidget
version of that colour picker.
}
\examples{
colourWidget()
colourWidget("red", palette = "limited", allowedCols = c("yellow", "red", "#123ABC"))

}