Modify the color of the sidebar menu items in R Shiny

I am trying to find out the tag name that can be used to change the color of the blue line in the menuItem image on Shiny Dashboard. I have successfully changed the background color of the sidebar menu item using the following code:

.skin-blue .main-sidebar .sidebar .sidebar-menu .active a{
    background-color: rgb(107,194,0);
    color: rgb(255,255,255);
    font-weight: bold;
    font-size: 18px;
}

Now, I want to customize the color of the blue line as well. Check out the image here.

EDIT: I have included the full code below. I have customized the colors for other parts but still need help with changing the color of the blue line.

library(shiny)
library(shinydashboard)

ui <- dashboardPage(

dashboardHeader(),

dashboardSidebar(

sidebarMenu(
  menuItem("Folder", tabName = "root", icon = icon("folder")),
  menuItem("My Home", tabName = "home", icon = icon("home")),
  menuItem("Document", tabName = "document", icon = icon("document"))
)

),
dashboardBody(

tags$head(tags$style(HTML('
                          /* Logo */
                          .skin-blue .main-header .logo {
                          background-color: rgb(255,255,255); 
                          color: rgb(0,144,197);
                          font-weight: bold;
                          font-size: 24px;
                          text-align: right;
                          }

                          /* Hover effect on logo */
                          .skin-blue .main-header .logo:hover {
                          background-color: rgb(255,255,255);
                          }

                          /* Navbar */
                          .skin-blue .main-header .navbar {
                          background-color: rgb(255,255,255);
                          }

                          /* Main Sidebar */
                          .skin-blue .main-sidebar {
                          background-color: rgb(255,125,125);;
                          }

                          /* Active selected tab in sidebarmenu */
                          .skin-blue .main-sidebar .sidebar .sidebar-menu .active a{
                          background-color: rgb(107,194,0);
                          color: rgb(255,255,255);
                          font-weight: bold;
                          font-size: 18px;
                          }

                          /* Other links in sidebarmenu */
                          .skin-blue .main-sidebar .sidebar .sidebar-menu a{
                          background-color: rgb(255,125,125);
                          color: rgb(255,255,255);
                          font-weight: bold;
                          }

                          /* Hover effect on other links in sidebarmenu */
                          .skin-blue .main-sidebar .sidebar .sidebar-menu a:hover{
                          background-color: rgb(232,245,251);
                          color: rgb(0,144,197);
                          font-weight: bold;
                          }

                          /* Toggle button color */
                          .skin-blue .main-header .navbar .sidebar-toggle{
                          background-color: rgb(255,255,255);
                          color: rgb(0,144,197);
                          }

                          /* Hover effect on toggle button */
                          .skin-blue .main-header .navbar .sidebar-toggle:hover{
                          background-color: rgb(0,144,197);
                          color: rgb(255,255,255);
                          }
#                           ')))

))


server <- shinyServer(function(input, output, session) {

})

shinyApp(ui, server)

Answer №1

To modify the color, utilize the subsequent CSS code:

.skin-navy .sidebar-menu > li.active > a {
  border-left-color: #00ff00;
}

Remember that switching the dashboard's skin theme may necessitate modifications to this CSS as it relies on the .skin-navy theme. It is also worth noting that this adjustment will not affect the blue bar's hue when a menu item is hovered over. For that purpose, amend the CSS above to:

.skin-navy .sidebar-menu > li.active > a,
.skin-navy .sidebar-menu > li:hover > a {
  border-left-color: #00ff00;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to install R packages on Ubuntu 8.10

Greetings! As a newcomer to Linux from an OS X background, please forgive any lack of knowledge on my part. After successfully installing R using Synaptic, I am now embarking on the task of installing packages. When I launch R and attempt to run: instal ...

The issue I'm facing is that the "background-image" is not resizing automatically when changing orientation in CSS on

I've encountered an issue with displaying an image in the DOM that is sized based on the screen height. While this setup works flawlessly on most browsers and devices I've tested, Safari iOS 7 seems to be causing some trouble. Specifically, in S ...

Tips for effectively placing a page scope block using BEM

Here is the current structure of my header. The page component is assumed to be the root. Currently, the geometry of the social-links block is being controlled by the header__social-links mix (positioned absolutely relative to the header). How can I prop ...

How to vertically align a div or input element with Bootstrap

https://i.sstatic.net/2OHp2.png This is the code I'm currently using: <body class="bg-light"> <div class="row justify-content-center mt-3"> <div class="col-6"> <in ...

Navigation arrows for sliding`

Is there a way to add custom right/left arrows to the Ionic slider component? Demo: Check it out on Stackblitz Note: Make sure to refer to the home.html page for more details. https://i.sstatic.net/jQ62l.png .html <ion-slides [pager]="true" [slide ...

Error in Compass Compilation when encountering Unicode Characters

After compiling with Compass, I noticed that if I don't include @charset "UTF-8"; in my root scss file, the output looks like this: @charset "IBM437"; Even though my CSS output still displays the correct Unicode characters, such as: content: "ĐĂN ...

Columns with adjustable widths

I am looking to create a layout with 3 columns (which may change, could be up to 4) that are all flexible width and fill the screen. Does anyone know if this is possible using CSS? Basically, I want three blocks lined up horizontally that take up the enti ...

What is the purpose of the `hidden` class for the `<hr>` element?

I've been tasked with updating a webpage that was passed down to me. One thing I'm working on is adding a print.css file, as it didn't have one before. The original developer included a... <hr class="hidden" /> The main css file has ...

Modify the variable to encompass a multitude of hues - scss

Hello, I am looking to modify the background of a page for dark mode. This is the current background styling: $orangeLight:#FFA500!default; $redLight:#FA8072!default; $blueLight:#B0C4DE!default; $greenLight:#90EE90!default; $list2: $blueLight 0%,$blueLi ...

Is it possible to merge CSS transitions and animations?

Hi there, I'm encountering an issue when trying to combine CSS transitions and animations. It seems that when I add a transition, it cancels out the animation that is working. Does anyone have any insights on how to successfully merge them together? ...

An issue in D3.js where the chart bars are not properly synced with the x-axis labels

Currently delving into the world of d3.js for the first time. In our project, we needed to adjust the width of each bar from .attr('width', xScale.rangeBand()) line 46 to .attr('width', '10') line 50 After making this cha ...

Using the jQuery plugin multiple times within one website

I have a decent understanding of jQuery and I'm in the process of developing a plugin. Specifically, it's a dropdown element that I'm working on. Everything functions correctly when there's only one dropdown on the site. However, when ...

Enable hovering only on the actual content within the box, not on the empty space

Currently, I am working on creating a navigation bar using flexbox. Everything seems to be functioning correctly except for one issue: when I hover over the space between my logo and the navigation links, it changes the color of my logo to the hover state ...

Design your own unique HTML webpage

My goal is to create a screen using divs that includes a big div which aligns with the month of October. This big div should be movable across the months, and when it stacks on a specific month, a form should be submitted. I am seeking assistance with po ...

Keep some table columns locked in place on your webpage while others are located off-screen, requiring a scroll to access

I have a question regarding an HTML table. There is a windows application that features a vertical scrollable table where some columns are fixed on the page while others remain outside the page. Here is an example: The black border represents the responsi ...

Creating an endless ticker animation in AngularJS that dynamically adjusts to element dimensions

This is my initial foray into AngularJS, where I am creating a ticker display comprised of boxes. Check out the CodePen here The Code: index.jade: doctype html html(ng-app="ticker") head script(src="../bower_components/angular/angular.js" ...

Navigation Bar Dropdown Menu Not Responding to Clicks

I'm having trouble implementing a dropdown menu in my navigation bar that should appear when the user clicks and disappear when they click anywhere outside of it, similar to Facebook's dropdown menu with options like logout. However, for some rea ...

Tips for aligning an icon vertically alongside text in Bootstrap 3

I've been attempting to center a Bootstrap glyphicon vertically in one column while aligning the text in another column. I've experimented with using tables and ghost cells (referencing Centering in the unknown). I'm hoping there's a so ...

Aligning elements vertically in Bootstrap 4 with the power of flexbox

Seeking assistance with a frustrating issue in Bootstrap 4: I tried to implement the align-self-start flexbox alignment using the code from this page . However, the example provided on that page does not seem to work. Is there a simpler way to achieve the ...

Placing markers on a straight path

Struggling to create a CSS component where the first and last points don't align properly with the ends of the line. This component should be able to handle any number of points (between 1 and 4) without relying on flexbox. I have a React component ...