regex_palette: Extracts a color palette from a string

Description Usage Arguments Value Examples

View source: R/regex_palette.R

Description

This function takes rather messy strings and extracts the color palette presented as hexadesimals and returns them as a string.

Usage

1

Arguments

text

A character vector of length 1 or more.

Value

A color palette as a string or a list of strings depending on the input.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
text1 <- "3b59988b9dc3dfe3eef7f7f7ffffff"
text2 <- "the palatte is #3472bc, #345682 then #112233 and finally #cbac43"

# Returns vector when input is of length 1
regex_palette(text1)
regex_palette(text2)

text3 <- c("3b59988b9dc3dfe3eef7f7f7ffffff", "3b59988b9dc3dfe3eef7f7f7ffffff")

regex_palette(text3)

EmilHvitfeldt/quickpalette documentation built on April 30, 2021, 9:22 p.m.