简体   繁体   English

更改材料开关 colors in Shiny

[英]Change materialSwitch colors in Shiny

How can I change the colors of a materialSwitch element in a Shiny app?如何在 Shiny 应用程序中更改materialSwitch元素的 colors? I know that tags$style(...) can be used inside ui.R to modify CSS styles, but I don't know the specific class names of these kind of elements. I know that tags$style(...) can be used inside ui.R to modify CSS styles, but I don't know the specific class names of these kind of elements.

I just found out how to change the color of an active MaterialSwitch button.我刚刚发现了如何更改活动 MaterialSwitch 按钮的颜色。 Just add the following to your Shiny app on your ui.R file:只需将以下内容添加到您的 ui.R 文件中的 Shiny 应用程序中:

tags$style(type = "text/css", "
  .label-default {background-color: #1574D6;}
  "),

In this example, the switch turns to color blue when active.在此示例中,开关在激活时变为蓝色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM