11// credit: https://www.adamsdesk.com/posts/admonitions-jekyll
22$primary-color : #fc0 ;
33$primary-bgcolor : rgba (55.59% , 44.41% , 0% , .4 );
4+
5+ // Light theme admonition title colors
6+ $admonitions-light :
7+ (' attention' , ' #ffebee' )
8+ (' caution' , ' #fff3e0' )
9+ (' danger' , ' #ffebee' )
10+ (' error' , ' #ffebee' )
11+ (' hint' , ' #e8f5e9' )
12+ (' important' , ' #fff3e0' )
13+ (' note' , ' #e3f2fd' )
14+ (' seealso' , ' #e3f2fd' )
15+ (' tip' , ' #e8f5e9' )
16+ (' todo' , ' #f5f5f5' )
17+ (' warning' , ' #fff3e0' )
18+ ;
19+
20+ // Dark theme admonition title colors
21+ $admonitions-dark :
22+ (' attention' , ' #564444' )
23+ (' caution' , ' #564b3c' )
24+ (' danger' , ' #564444' )
25+ (' error' , ' #564444' )
26+ (' hint' , ' #294040' )
27+ (' important' , ' #433a38' )
28+ (' note' , ' #293d52' )
29+ (' seealso' , ' #293d52' )
30+ (' tip' , ' #294040' )
31+ (' todo' , ' #3a3a3a' )
32+ (' warning' , ' #564b3c' )
33+ ;
34+
435$admonitions :
5- // class (type), icon filename, icon/border color, title bg color
36+ // class (type), icon filename, icon/border color
637 // TODO: Can we use font-awesome directly without keeping the svg files in our repo?
7- (' attention' , ' exclamation-triangle-solid.svg' , ' #ff5252' , ' #564444' )
8- (' caution' , ' bolt-solid.svg' , ' #ff9100' , ' #564b3c' )
9- (' danger' , ' bolt-solid.svg' , ' #ff5252' , ' #564444' )
10- (' error' , ' times-circle-solid.svg' , ' #ff5252' , ' #564444' )
11- (' hint' , ' question-circle-solid.svg' , ' #00c953' , ' #294040' )
12- (' important' , ' fire-solid.svg' , ' #ff9100' , ' #433a38' )
13- (' note' , ' pen-solid.svg' , ' #00b0ff' , ' #293d52' )
14- (' seealso' , ' info-circle-solid.svg' , ' #00b0ff' , ' #293d52' )
15- (' tip' , ' info-circle-solid.svg' , ' #00c953' , ' #294040' )
16- (' todo' , ' pen-solid.svg' )
17- (' warning' , ' exclamation-triangle-solid.svg' , ' #ff9100' , ' #564b3c' )
18-
19- // ('note', 'pen-solid.svg')
20- // ('abstract', 'align-left-solid.svg')
21- // ('info', 'info-circle-solid.svg', '#00b0ff', '#293d52')
22- // ('tip', 'fire-solid.svg', '#ff9100', '#433a38')
23- // ('success', 'check-circle-solid.svg', '#00c953', '#294040')
24- // ('question', 'question-circle-solid.svg', '#00b8d4', '#293e4e')
25- // ('warning', 'exclamation-triangle-solid.svg', '#ff9100', '#564b3c')
26- // ('failure', 'times-circle-solid.svg', '#ff5252', '#564444')
27- // ('danger', 'bolt-solid.svg', '#ff1744', '#563e43')
28- // ('bug', 'bug-solid.svg', '#f50057', '#553c45')
29- // ('example', 'list-ol-solid.svg', '#9e9e9e', '#4c4c4c')
30- // ('quote', 'quote-right-solid.svg', '#9e9e9e', '#4c4c4c')
38+ (' attention' , ' exclamation-triangle-solid.svg' , ' #ff5252' )
39+ (' caution' , ' bolt-solid.svg' , ' #ff9100' )
40+ (' danger' , ' bolt-solid.svg' , ' #ff5252' )
41+ (' error' , ' times-circle-solid.svg' , ' #ff5252' )
42+ (' hint' , ' question-circle-solid.svg' , ' #00c953' )
43+ (' important' , ' fire-solid.svg' , ' #ff9100' )
44+ (' note' , ' pen-solid.svg' , ' #00b0ff' )
45+ (' seealso' , ' info-circle-solid.svg' , ' #00b0ff' )
46+ (' tip' , ' info-circle-solid.svg' , ' #00c953' )
47+ (' todo' , ' pen-solid.svg' , ' #9e9e9e' )
48+ (' warning' , ' exclamation-triangle-solid.svg' , ' #ff9100' )
3149;
3250.admonition {
3351 margin : 1.5625em 0 ;
@@ -47,6 +65,12 @@ $admonitions:
4765 font-weight : 700 ;
4866 line-height : 3rem ;
4967}
68+
69+ // Light theme - keep title text dark
70+ [data-bs-theme = " light" ] .admonition .admonition-title {
71+ color : #212529 ;
72+ }
73+
5074.admonition-title ::before {
5175 margin-right : .5rem ;
5276 width : 1.2rem ;
@@ -58,17 +82,12 @@ $admonitions:
5882 background-color : $primary-color ;
5983 vertical-align : text-bottom ;
6084}
61- @each $name , $icon , $icon-color , $title-color in $admonitions {
85+ @each $name , $icon , $icon-color in $admonitions {
6286 @if $icon-color {
6387 .admonition.#{$name } {
6488 border-left-color : #{$icon-color } ;
6589 }
6690 }
67- @if $title-color {
68- .admonition.#{$name } .admonition-title {
69- background-color : #{$title-color } ;
70- }
71- }
7291 .admonition.#{$name } .admonition-title ::before {
7392 -webkit-mask : url (" /assets/img/icons/#{$icon } " ) no-repeat 50% 50% ;
7493 mask : url (" /assets/img/icons/#{$icon } " ) no-repeat 50% 50% ;
@@ -77,3 +96,17 @@ $admonitions:
7796 }
7897 }
7998}
99+
100+ // Apply light theme title backgrounds
101+ @each $name , $light-bg in $admonitions-light {
102+ [data-bs-theme = " light" ] .admonition.#{$name } .admonition-title {
103+ background-color : #{$light-bg } ;
104+ }
105+ }
106+
107+ // Apply dark theme title backgrounds
108+ @each $name , $dark-bg in $admonitions-dark {
109+ [data-bs-theme = " dark" ] .admonition.#{$name } .admonition-title {
110+ background-color : #{$dark-bg } ;
111+ }
112+ }
0 commit comments