validateHex: Validate a hexadecimal color representation.

Description Usage Arguments Details Value Examples

View source: R/correally.R

Description

validateHex returns if a string vector contains color representations in hexadecimal format.

Usage

1
validateHex(string, shorthand = FALSE, ignore.case = FALSE)

Arguments

string

String vector.

shorthand

A logical scalar. If TRUE, the validation is performed against the shorthand notation and if FALSE, validation is performed against the normal notation.

ignore.case

A logical scalar. If FALSE, the validation is case sensitive and if TRUE, case is ignored during validation.

Details

This function validates a given hexadecimal color representation. It can check the normal hexadecimal notation (e.g. #FFFFFF) or the shorthand notation (e.g. #FFF).

Value

Returns a logical vector of the same length as the string input.

Examples

1
2
3
4
5
6
7
8
validateHex("#FFFFFF")
validateHex("#FFF")
validateHex("#FFF", shorthand = TRUE)

validateHex("#ffffff")
validateHex("#ffffff", ignore.case = TRUE)

validateHex(c("#FFFFFF","asdf"))

addiversitas/correally documentation built on Oct. 4, 2020, 12:14 a.m.