Styling our application with themes
Up to this point, we have been using the theme provided by default by Shiny, but now that our application is finished, we want to stylize it with some tech-looking colors. In that case, we can use the shinythemes
and ggthemr
packages, which provide us with an easy way to apply themes to Shiny applications and ggplot2
graphs, respectively.
All we need to do to apply the themes is to tell the ggplot2
framework to apply the flat dark theme provided by the ggthemr
package, and to make sure that the outer side of the graph is also stylized we use the type = outer
parameter, as is shown here. The code should be placed wherever we placed our ggplot2
code for cohesiveness, which is in the functions.R
file for this chapter:
library(ggthemr) ggthemr('flat dark', type = 'outer')
To stylize the Shiny application itself, we send the theme
parameter, using the shinytheme()
function, to the fluidPage()
function just before our titlePanel()
function call, as is shown here...