Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Dynamically change Shinydashboard css style elements

I need to whitelabel a shiny dashboard build within the shinydashboard package framework. For this I need to change the following tag code in my dashboard body dynamically:

tags$head(tags$style(HTML('
        /* logo */
        .skin-blue .main-header .logo {
                              background-color: #545454;
                              }')))

js <-"Shiny.addCustomMessageHandler('change_logo', function(logo_W) {
  /* logo */
    .skin-blue .main-header .logo {
      background-color: logo_W;
    }
});"

ui <- function() {
    dashboardPage(dashboardHeader(),
                  dashboardSidebar(),
                  dashboardBody(
                      tags$head(tags$style(HTML(js))),
                  ),
                  skin = "blue")
}

server <- function(input, output, session) {
start <- reactiveVal(1)
    observeEvent(start() == 1 , {
        session$sendCustomMessage("change_logo", "#545454")
    })
}

shinyApp(ui, server)

I tried to solve the problem in a few ways. One option was to put everything in a UIoutput, but this

doesn't work with shinydashboard, the css doesn't register and it messes up the initiation process.

I tried opening the shinyapp within another app to do a call in the starting app to the server for

the colorcoding, too bad that doesn't work either.

My plan is to do it with java then and I got this code so far for one the logo part of the style

tag. It doesn't work either, but saw an example of this where someone changed the skin color with

similar code, so it should be possible.

The help is much appreciated

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda