Skip to contents

Create a bslib::bs_theme() styled with a Liquid Glass look: translucent surfaces, backdrop blur, soft depth, and system typography. Pass the result to theme = on fluidPage(), navbarPage(), bslib::page_sidebar(), or any other page function that accepts a bslib theme.

Usage

glass_theme(
  preset = c("light", "dark"),
  primary = "#007AFF",
  blur = 28,
  saturation = 200,
  radius = "1.25rem",
  ...
)

Arguments

preset

"light" or "dark". Switches the full color system.

primary

Accent color for buttons, links, and focus rings. Defaults to system blue (#007AFF).

blur

Backdrop blur radius in pixels.

saturation

Backdrop saturation percentage.

radius

Default border radius for glass surfaces (CSS length).

...

Additional arguments forwarded to bslib::bs_theme().

Value

A bslib::bs_theme() object suitable for Shiny page functions.

Examples

theme <- glass_theme()
dark <- glass_theme(preset = "dark", primary = "#BF5AF2")

if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    theme = glass_theme(),
    titlePanel("Liquid Glass"),
    selectInput("color", "Color", c("Blue", "Purple", "Orange")),
    plotOutput("plot")
  )

  shinyApp(ui, function(...) {})
}