-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
350 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
#' Bootstrap Theme based on Nord palette | ||
#' | ||
#' @param version The major version of Bootstrap to use, see [bslib::bs_theme()]. | ||
#' @param preset The name of a theme preset, default to "bootstrap". | ||
#' | ||
#' @return Returns a [sass::sass_bundle()] (list-like) object. | ||
#' @export | ||
#' | ||
#' @name bs-theme-nord | ||
#' | ||
#' @example examples/bs_theme_nord-ex.R | ||
bs_theme_nord_light <- function(version = bslib::version_default(), preset = "bootstrap") { | ||
bs_theme( | ||
version = version, | ||
preset = preset, | ||
primary = "#5E81AC", | ||
secondary = "#B48EAD", | ||
info = "#88C0D0", | ||
danger = "#BF616A", | ||
warning = "#D08770", | ||
success = "#A3BE8C", | ||
"navbar-bg" = "#5E81AC", | ||
"navbar-dark-color" = "#ECEFF4", | ||
"navbar-dark-color" = "#ECEFF4", | ||
"navbar-dark-active-color" = "#E5E9F0", | ||
"navbar-dark-hover-color" = "#D8DEE9", | ||
"bslib-sidebar-bg" = "#D8DEE9", | ||
"body-bg" = "#ECEFF4", | ||
"body-color" = "#2E3440" | ||
) | ||
} | ||
|
||
#' @export | ||
#' | ||
#' @rdname bs-theme-nord | ||
bs_theme_nord_dark <- function(version = bslib::version_default(), preset = "bootstrap") { | ||
bs_theme( | ||
version = version, | ||
preset = preset, | ||
primary = "#5E81AC", | ||
secondary = "#B48EAD", | ||
info = "#88C0D0", | ||
danger = "#BF616A", | ||
warning = "#D08770", | ||
success = "#A3BE8C", | ||
"navbar-bg" = "#2E3440", | ||
"navbar-dark-color" = "#ECEFF4", | ||
"navbar-dark-color" = "#ECEFF4", | ||
"navbar-dark-active-color" = "#E5E9F0", | ||
"navbar-dark-hover-color" = "#D8DEE9", | ||
"bslib-sidebar-bg" = "#3B4252", | ||
"bslib-sidebar-fg" = "#ECEFF4", | ||
"body-bg" = "#434C5E", | ||
"body-color" = "#ECEFF4", | ||
"card-bg" = "#4C566A", | ||
"body-emphasis-color" = "#ECEFF4" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
|
||
library(shiny) | ||
library(bslib) | ||
library(bsicons) | ||
|
||
make_btns <- function(outline = FALSE) { | ||
lapply( | ||
X = c("primary", "secondary", "success", "danger", "warning", "info"), | ||
FUN = function(x) { | ||
if (outline) | ||
x <- paste0("outline-", x) | ||
actionButton(paste0("btn", x), paste("Button", x), class = paste("btn", x, sep = "-")) | ||
} | ||
) | ||
} | ||
|
||
ui <- page_navbar( | ||
title = "Nord theme", | ||
|
||
theme = bs_theme_nord_light(), | ||
|
||
fillable = FALSE, | ||
sidebar = sidebar( | ||
"Sidebar", | ||
selectInput("id", "Choice:", month.name) | ||
), | ||
nav_panel( | ||
"Page 1", | ||
|
||
make_btns(), | ||
tags$br(), tags$br(), | ||
make_btns(TRUE), | ||
tags$br(), tags$br(), | ||
|
||
layout_column_wrap( | ||
width = 1 / 5, | ||
value_box( | ||
title = "1st value", | ||
value = "123", | ||
showcase = bs_icon("bar-chart"), | ||
theme = "primary", | ||
p("The 1st detail") | ||
), | ||
value_box( | ||
title = "2nd value", | ||
value = "456", | ||
showcase = bs_icon("graph-up"), | ||
theme = "success", | ||
p("The 2nd detail"), | ||
p("The 3rd detail") | ||
), | ||
value_box( | ||
title = "3rd value", | ||
value = "789", | ||
showcase = bs_icon("pie-chart"), | ||
theme = "danger", | ||
p("The 4th detail"), | ||
p("The 5th detail"), | ||
p("The 6th detail") | ||
), | ||
value_box( | ||
title = "4th value", | ||
value = "123", | ||
showcase = bs_icon("bar-chart"), | ||
theme = "warning", | ||
p("The 1st detail") | ||
), | ||
value_box( | ||
title = "5th value", | ||
value = "123", | ||
showcase = bs_icon("bar-chart"), | ||
theme = "info", | ||
p("The 1st detail") | ||
) | ||
), | ||
layout_column_wrap( | ||
width = 1 / 5, | ||
card( | ||
card_header( | ||
class = "bg-primary", | ||
"A header" | ||
), | ||
card_body("Some content") | ||
), | ||
card( | ||
card_header( | ||
class = "bg-success", | ||
"A header" | ||
), | ||
card_body("Some content") | ||
), | ||
card( | ||
card_header( | ||
class = "bg-danger", | ||
"A header" | ||
), | ||
card_body("Some content") | ||
), | ||
card( | ||
card_header( | ||
class = "bg-warning", | ||
"A header" | ||
), | ||
card_body("Some content") | ||
), | ||
card( | ||
card_header( | ||
class = "bg-info", | ||
"A header" | ||
), | ||
card_body("Some content") | ||
) | ||
) | ||
), | ||
nav_panel("Page 2", "Page 2 content"), | ||
nav_spacer(), | ||
nav_item( | ||
input_switch("dark_mode", "Dark mode", width = "120px") | ||
) | ||
) | ||
|
||
server <- function(input, output, session) { | ||
observe(session$setCurrentTheme( | ||
if (isTRUE(input$dark_mode)) bs_theme_nord_dark() else bs_theme_nord_light() | ||
)) | ||
} | ||
|
||
if (interactive()) | ||
shinyApp(ui, server) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.