Closed AdrianAntico closed 1 year ago
Hello,
You can override the background color using boxStyle =
argument, here's an example :
library(shiny)
library(esquisse)
ui <- fluidPage(
theme = bslib::bs_theme(version = 5L, bg = "#0A0A2A", fg = "#FFF"),
tags$h2("Demo dragulaInput"),
tags$br(),
fluidRow(
column(
width = 6,
dragulaInput(
inputId = "dad1",
label = "Default:",
sourceLabel = "Source",
targetsLabels = c("Target 1", "Target 2"),
choiceNames = lapply(
X = month.abb,
FUN = function(x) {
tags$span(class = "badge text-bg-dark", x)
}
),
choiceValues = month.abb,
boxStyle = "background-color: #131332 !important; border: 1px solid #53536A !important;",
width = "100%"
),
verbatimTextOutput(outputId = "result1"),
tags$br(),
dragulaInput(
inputId = "dad3",
label = "On same row:",
sourceLabel = "Source",
targetsLabels = c("Target 1", "Target 2"),
choices = month.abb,
width = "100%",
ncolSource = 1,
ncolGrid = 3
),
verbatimTextOutput(outputId = "result3")
)
)
)
server <- function(input, output, session) {
output$result1 <- renderPrint(str(input$dad1))
output$result3 <- renderPrint(str(input$dad3))
}
shinyApp(ui = ui, server = server)
Which gives :
@pvictor thanks for the update. Is there a way to modify via css or do I have to supply the values to the dragulaInput() call?
Yes can use CSS classes : .box-dad
and .container-drag-source
, using something like :
tags$style(
".box-dad, .container-drag-source {background-color: #131332 !important; border: 1px solid #53536A !important;}"
)
But I've noticed that you can't change color of the text inside the box currently, it'll need that I add an argument to the function.
@pvictor thanks for the update!!
I've tried everything to get around the default white background and it looks like the only way is to change it up is to modify the source file that defines it as such. For apps with colored themes, the white can be an eye sore in some cases, particularly with night theme designs.
If you remove (or comment out like I did) the "background-color: white; " at the bottom of the make_bg_svg() function users can then apply their own css for coloring those boxes as such: