Skip to contents

A generic that derives a reproducible syn_palette from a prosody score, an image, an audio waveform, or raw text. Each source type has its own method; the result is always the same syn_palette object, so palettes are interchangeable across the suite regardless of where they came from.

Usage

syn_palette(x, n = 5L, ...)

# S3 method for class 'prosody_score'
syn_palette(x, n = 5L, ...)

# S3 method for class 'character'
syn_palette(x, n = 5L, lang = NULL, ...)

# S3 method for class '`magick-image`'
syn_palette(x, n = 5L, ...)

# S3 method for class 'Wave'
syn_palette(x, n = 5L, ...)

Arguments

x

A source object: a prosody_score, a magick-image, a tuneR::Wave, or a character string.

n

Number of colours. Default 5L.

...

Passed to methods.

lang

Language code passed through to syn_read_text() for the character method.

Value

A syn_palette object with colors (hex), roles, mode ("warm"/"cool"/"mixed"), temperature (-1 cool to 1 warm), and source (what it was extracted from).

See also

Other palette functions: is_syn_palette(), syn_theme()

Examples

syn_palette(syn_score(syn_read_text("A bright warm day.", lang = "en")))
#> <syn_palette> - 5 colours, mixed, from prosody_score
#> "#484700" background
#> "#4F7400" shadow
#> "#4AA33B" mid
#> "#3DD48E" accent
#> "#44FFDA" highlight