glass_select_theme: Create a custom color theme for glass select widgets

View source: R/glass_select_theme.R

glass_select_themeR Documentation

Create a custom color theme for glass select widgets

Description

All color arguments accept any valid CSS color string (hex, rgb(), rgba(), named colors). Unset fields inherit from the mode base preset.

Usage

glass_select_theme(
  mode = c("dark", "light"),
  bg_color = NULL,
  border_color = NULL,
  text_color = NULL,
  accent_color = NULL,
  focus_ring = NULL,
  label_color = NULL
)

Arguments

mode

Base preset. One of "dark" (default) or "light". Custom colors are layered on top.

bg_color

Background of the trigger button and dropdown panel.

border_color

Border color of the trigger and dropdown.

text_color

Main text color for options and the trigger label.

accent_color

Highlight color for checkmarks, badges, and selected states.

focus_ring

Keyboard focus indicator color. Choose a color with at least 3:1 contrast against the trigger and dropdown surfaces.

label_color

Widget label color. Defaults to text_color when NULL.

Value

A named list of class "glass_select_theme" for passing to the theme argument of glassMultiSelect() or glassSelect().

Examples

# Teal accent on a dark base
teal_theme <- glass_select_theme(
  mode         = "dark",
  accent_color = "#2dd4bf",
  bg_color     = "rgba(9, 20, 42, 0.97)"
)

# Light mode with a custom purple accent
purple_light <- glass_select_theme(
  mode         = "light",
  accent_color = "#7c3aed",
  border_color = "rgba(124, 58, 237, 0.35)"
)

if (interactive()) {
  library(shiny)
  choices <- c(Revenue = "rev", Orders = "ord", Returns = "ret")
  ui <- fluidPage(
    useGlassTabs(),
    glassMultiSelect("metric", choices, theme = teal_theme),
    glassSelect("region", c(All = "all", North = "n", South = "s"),
                theme = purple_light)
  )
  server <- function(input, output, session) {}
  shinyApp(ui, server)
}


glasstabs documentation built on Sept. 11, 2026, 5:08 p.m.