How to draw a line with color in a brilliant application

It may be the easiest for many people, but I struggle with it. I would like to draw a line with color using the hr html tag. This is what I have tried so far in the ui.R file:

HTML("<hr color='purple' >") HTML('<hr color="purple" >') hr( color="purple" ) 

None of them worked - please, any suggestions?

+6
source share
2 answers

Brilliant provides a lot of control over the appearance of the application, but it happens that the color hr not one of them. Thus, you will need to dig into CSS to control the appearance of the element. You can do this using includeCSS in Shiny to add a stylesheet that you can use to control the look of your application. However, the easiest way would be to simply add CSS to your hr element.

 HTML('<hr style="color: purple;">') 

(EDIT) Note that although this will work for most elements, hr does not respect the color property. hr behave strangely: Change the color of the hr element

Here you change the CSS color property of your hr element. See https://developer.mozilla.org/en-US/docs/Web/CSS/color

Also note that you can use hr(style="...") instead of creating raw HTML if you want. I found that building everything with bright tags makes the code easier to read in most cases, but YMMV.

0
source

It took a little digging / reading the answers and comments here, but, summing up, this seems to work (I tested on Mac Chrome, Safari and Firefox):

 tags$hr(style="border-color: purple;") 

You can also use HTML() if you want, but you can stick with Shiny tags , IMHO.

+10
source

All Articles