您好,我正在玩 {fresh} 主题包和 {bs4Dash}。我要做的是更改应用程序的主要背景。但是,看起来包 bs4Dash 不会让我在选择“深色”主题时更改主背景。一旦我将切换开关切换到“浅色”皮肤,就会显示所需的背景颜色。看来我无法控制暗模式背景。
下面是一张照片以及可重现的代码。例如,我想当皮肤被轻弹到暗模式时,背景颜色是下面代码中的浅蓝色。
library(bs4Dash)
library(shiny)
library(fresh)
# create the theme with a cyberpunk color palette
theme <- create_theme(
bs4dash_vars(
navbar_light_color = "#bec5cb",
navbar_light_active_color = "#FFF",
navbar_light_hover_color = "#FFF"
),
bs4dash_yiq(
contrasted_threshold = 10,
text_dark = "#FFF",
text_light = "#272c30"
),
bs4dash_layout(
main_bg = "#5E81AC"
),
bs4dash_sidebar_light(
bg = "#272c30",
color = "#bec5cb",
hover_color = "#FFF",
submenu_bg = "#272c30",
submenu_color = "#FFF",
submenu_hover_color = "#FFF"
),
bs4dash_status(
primary = "#5E81AC", danger = "#BF616A", light = "#272c30"
),
bs4dash_color(
gray_900 = "#FFF", white = "#272c30"
)
)
# create tribble for box global config
box_config <- tibble::tribble(
~background, ~labelStatus,
"danger", "warning",
"purple", "success",
"success", "primary",
"warning", "danger",
"fuchsia", "info"
)
# box factory function
box_factory <- function(background, labelStatus) {
box(
title = "Cyberpunk Box",
collapsible = TRUE,
background = background,
height = "200px",
label = boxLabel(1, labelStatus)
)
}
# pmap magic
boxes <- purrr::pmap(box_config, box_factory)
shinyApp(
ui = dashboardPage(
freshTheme = theme,
header = dashboardHeader(
leftUi = dropdownMenu(
type = "messages",
badgeStatus = "success",
messageItem(
from = "Support Team",
message = "This is the content of a message.",
time = "5 mins"
),
messageItem(
from = "Support Team",
message = "This is the content of another message.",
time = "2 hours"
)
)
),
sidebar = dashboardSidebar(),
body = dashboardBody(boxes),
controlbar = dashboardControlbar(),
title = "Fresh theming"
),
server = function(input, output) { }
)