This function prints and visualizes predefined color palettes. Users can specify a `color_tone` and `palette_type` to display the corresponding colors. Additionally, calling `color_tone = "all"` returns a list of callable functions, where each entry dynamically generates a color palette visualization.
Arguments
- color_tone
Character. The name of the predefined color theme. Default is `NULL`, which requires specification. Available themes include:
Academic: A balanced set of colors for research-oriented visuals.
Purdue: Themed after Purdue University branding.
Colorblind: Designed for colorblind-friendly visualization.
Economic: Used for economic data visualization.
Trade: Suited for trade-related data.
GTAP: Based on Global Trade Analysis Project visuals.
GTAP2: An alternative GTAP color set.
Earth: Inspired by natural, earthy tones.
Vibrant: High-contrast and energetic colors.
Bright: Bright and playful color combinations.
Minimal: Monochrome and muted colors for minimalistic designs.
Energetic: Warm and dynamic tones.
Pastel: Soft pastel shades.
Spring: Fresh, floral-inspired hues.
Summer: Sunny, warm color gradients.
Winter: Cool, icy tones for winter visuals.
Fall: Autumn-inspired warm color palette.
Blue_mono, Green_mono, Red_mono, Grey_mono: Monochromatic shades for respective colors.
Use `"all"` to return a list of callable functions for all palettes.
- palette_type
Character. The type of color palette to use. Options include:
"qualitative" - Best for categorical data.
"sequential" - Used for ordered, continuous scales.
"diverging" - Ideal for highlighting contrasts.
Default is `"qualitative"`.
Value
If a specific `color_tone` is provided, it prints the color palette and returns `NULL`.
If `color_tone = "all"`, it returns a **list of callable functions** to visualize each palette on demand.
Details
The function retrieves colors from `.create_color_palette()` and provides a visual preview of the selected theme.
If `color_tone = "all"`, the function returns a **list of functions**, where calling any element (e.g., `all_palettes$winter()`) generates the corresponding color palette visualization.
If the requested `color_tone` does not exist or is empty, the function throws an error.
Examples
if (FALSE) { # \dontrun{
# Print & visualize a specific palette
get_color_palette("winter")
# Print & visualize another palette with different types
get_color_palette("fall", "sequential")
get_color_palette("academic", "diverging")
# Get all palettes as a list of callable functions
all_palettes <- get_color_palette("all")
# Click or call a specific palette function to view its colors
all_palettes$winter() # View the winter palette
all_palettes$fall() # View the fall palette
all_palettes$gtap() # View the GTAP palette
} # }