File: 009-code-styles-bs5.patch

package info (click to toggle)
r-cran-bslib 0.9.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,412 kB
  • sloc: javascript: 13,349; makefile: 33; sh: 23
file content (53 lines) | stat: -rw-r--r-- 2,414 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/inst/lib/bs5/scss/_reboot.scss b/inst/lib/bs5/scss/_reboot.scss
index 9ba1f30..320b963 100644
--- a/inst/lib/bs5/scss/_reboot.scss
+++ b/inst/lib/bs5/scss/_reboot.scss
@@ -302,9 +302,14 @@ pre {
   overflow: auto; // 3
   @include font-size($code-font-size);
   color: $pre-color;
+  background-color: $pre-bg;
+  padding: $spacer / 2;
+  border: $border-width solid var(--#{$prefix}border-color, $border-color);
+  @include border-radius($border-radius);
 
   // Account for some code outputs that place code tags in pre tags
   code {
+    background-color: transparent;
     @include font-size(inherit);
     color: inherit;
     word-break: normal;
@@ -314,6 +319,9 @@ pre {
 code {
   @include font-size($code-font-size);
   color: var(--#{$prefix}code-color);
+  background-color: $code-bg;
+  @include border-radius($border-radius);
+  padding: $spacer/8 $spacer/4;
   word-wrap: break-word;
 
   // Streamline the style when inside anchors to avoid broken underline and more
diff --git a/inst/lib/bs5/scss/_variables.scss b/inst/lib/bs5/scss/_variables.scss
index 30485106..9ff2f56c 100644
--- a/inst/lib/bs5/scss/_variables.scss
+++ b/inst/lib/bs5/scss/_variables.scss
@@ -1621,7 +1621,11 @@ $offcanvas-backdrop-opacity:        $modal-backdrop-opacity !default;
 // Code
 
 $code-font-size:                    $small-font-size !default;
-$code-color:                        $pink !default;
+// Amount intentionally matches mixture amount of shiny::inputPanel()
+// https://github.com/rstudio/shiny/blob/4eeb4a1/inst/www/shared/shiny_scss/bootstrap.scss#L25
+$code-bg:                           RGBA(var(--#{$prefix}emphasis-color-rgb, 0,0,0), 0.04) !default;
+$code-color:                        RGB(var(--#{$prefix}emphasis-color-rgb, 0,0,0)) !default;
+$code-color-dark:                   RGB(var(--#{$prefix}emphasis-color-rgb, 0,0,0)) !default;
 
 $kbd-padding-y:                     .1875rem !default;
 $kbd-padding-x:                     .375rem !default;
@@ -1630,4 +1633,5 @@ $kbd-color:                         var(--#{$prefix}body-bg) !default;
 $kbd-bg:                            var(--#{$prefix}body-color) !default;
 $nested-kbd-font-weight:            null !default; // Deprecated in v5.2.0, removing in v6
 
-$pre-color:                         null !default;
+$pre-bg:                            $code-bg  !default;
+$pre-color:                         $code-color !default;