I am using below code in server.R
to display the text in the main panel. This is working exactly the way it should work.
output$text1 <- renderText({ if(input$ag == 0) return(NULL) return('First 20 rows for requested AG') })
Is there any way to change the font and color of the text?
Go to Format > Font > Font. + D to open the Font dialog box. Select the arrow next to Font color, and then choose a color.
Shiny has many functions that can transform plain text into formatted text. Simply place text inside the h1() function to create a primary header (e.g. a title), h2() for a secondary header, strong() to make text bold, em() to make text italicized, or any of the other formatting functions.
Open your device's Settings app . Text and display. Select Color correction. Turn on Use color correction.
Navigate to Tools > Global Options > Appearance.
You can use css as @jbaums indicated
library(shiny) runApp(list( ui = bootstrapPage( numericInput('n', 'Number of obs', 100), textOutput('text1'), tags$head(tags$style("#text1{color: red; font-size: 20px; font-style: italic; }" ) ) ), server = function(input, output) { output$text1 <- renderText({ paste("hello input is",input$n) }) } ))
Normally you would include this in a styles.css
file but it is shown inline here to be self contained. #text1
refers to the DOM element with id=text1
and the contents of the curly brackets are the relevant styles.
in ui.r
:
span(textOutput("message"), style="color:red")
in server.r
:
output$message <- renderText({"This is some red text"})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With