Skip to content

Commit af61730

Browse files
committed
Notice: Fix issues with dark mode selection
Incorporate open PR from the repo: martignoni/hugo-notice#32
1 parent 4f5921a commit af61730

File tree

2 files changed

+84
-22
lines changed

2 files changed

+84
-22
lines changed

bin/theme-compare-notice.approved

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
--- _vendor/github.com/martignoni/hugo-notice/layouts/shortcodes/notice.html 2024-04-20 01:51:49
2+
+++ layouts/shortcodes/notice.html 2024-04-20 02:16:17
3+
@@ -23 +23 @@
4+
- --tip-content: #efe
5+
+ --tip-content: #efe;
6+
@@ -39 +39 @@
7+
- --tip-content: #121
8+
+ --tip-content: #121;
9+
@@ -43 +43 @@
10+
- body.dark .notice {
11+
+ body.dark .notice, [data-theme="dark"] .notice {
12+
@@ -55 +55 @@
13+
- --tip-content: #121
14+
+ --tip-content: #121;
15+
@@ -64 +64 @@
16+
- background: var(--root-background)
17+
+ background: var(--root-background);
18+
@@ -68 +68 @@
19+
- margin-bottom: 0
20+
+ margin-bottom: 0;
21+
@@ -77 +77 @@
22+
- background: var(--title-background)
23+
+ background: var(--title-background);
24+
@@ -81 +81 @@
25+
- background: var(--warning-title)
26+
+ background: var(--warning-title);
27+
@@ -85 +85 @@
28+
- background: var(--warning-content)
29+
+ background: var(--warning-content);
30+
@@ -89 +89 @@
31+
- background: var(--info-title)
32+
+ background: var(--info-title);
33+
@@ -93 +93 @@
34+
- background: var(--info-content)
35+
+ background: var(--info-content);
36+
@@ -97 +97 @@
37+
- background: var(--note-title)
38+
+ background: var(--note-title);
39+
@@ -101 +101 @@
40+
- background: var(--note-content)
41+
+ background: var(--note-content);
42+
@@ -105 +105 @@
43+
- background: var(--tip-title)
44+
+ background: var(--tip-title);
45+
@@ -109 +109 @@
46+
- background: var(--tip-content)
47+
+ background: var(--tip-content);
48+
@@ -115 +115 @@
49+
- margin-right: 8px
50+
+ margin-right: 8px;
51+
@@ -118,2 +118 @@
52+
- .icon-notice img,
53+
- .icon-notice svg {
54+
+ .icon-notice img, .icon-notice svg {
55+
@@ -122 +121 @@
56+
- fill: currentColor
57+
+ fill: currentColor;
58+
@@ -125,2 +124 @@
59+
- .icon-notice img,
60+
- .icon-notice.baseline svg {
61+
+ .icon-notice img, .icon-notice.baseline svg {
62+
@@ -128 +126 @@
63+
- position: relative
64+
+ position: relative;

layouts/shortcodes/notice.html

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
--note-title: #6be;
2121
--note-content: #e7f2fa;
2222
--tip-title: #5a5;
23-
--tip-content: #efe
23+
--tip-content: #efe;
2424
}
2525

2626
@media (prefers-color-scheme:dark) {
@@ -36,11 +36,11 @@
3636
--note-title: #069;
3737
--note-content: #023;
3838
--tip-title: #363;
39-
--tip-content: #121
39+
--tip-content: #121;
4040
}
4141
}
4242

43-
body.dark .notice {
43+
body.dark .notice, [data-theme="dark"] .notice {
4444
--root-color: #ddd;
4545
--root-background: #eff;
4646
--title-color: #fff;
@@ -52,7 +52,7 @@
5252
--note-title: #069;
5353
--note-content: #023;
5454
--tip-title: #363;
55-
--tip-content: #121
55+
--tip-content: #121;
5656
}
5757

5858
.notice {
@@ -61,11 +61,11 @@
6161
margin-bottom: 24px;
6262
border-radius: 4px;
6363
color: var(--root-color);
64-
background: var(--root-background)
64+
background: var(--root-background);
6565
}
6666

6767
.notice p:last-child {
68-
margin-bottom: 0
68+
margin-bottom: 0;
6969
}
7070

7171
.notice-title {
@@ -74,58 +74,56 @@
7474
border-radius: 4px 4px 0 0;
7575
font-weight: 700;
7676
color: var(--title-color);
77-
background: var(--title-background)
77+
background: var(--title-background);
7878
}
7979

8080
.notice.warning .notice-title {
81-
background: var(--warning-title)
81+
background: var(--warning-title);
8282
}
8383

8484
.notice.warning {
85-
background: var(--warning-content)
85+
background: var(--warning-content);
8686
}
8787

8888
.notice.info .notice-title {
89-
background: var(--info-title)
89+
background: var(--info-title);
9090
}
9191

9292
.notice.info {
93-
background: var(--info-content)
93+
background: var(--info-content);
9494
}
9595

9696
.notice.note .notice-title {
97-
background: var(--note-title)
97+
background: var(--note-title);
9898
}
9999

100100
.notice.note {
101-
background: var(--note-content)
101+
background: var(--note-content);
102102
}
103103

104104
.notice.tip .notice-title {
105-
background: var(--tip-title)
105+
background: var(--tip-title);
106106
}
107107

108108
.notice.tip {
109-
background: var(--tip-content)
109+
background: var(--tip-content);
110110
}
111111

112112
.icon-notice {
113113
display: inline-flex;
114114
align-self: center;
115-
margin-right: 8px
115+
margin-right: 8px;
116116
}
117117

118-
.icon-notice img,
119-
.icon-notice svg {
118+
.icon-notice img, .icon-notice svg {
120119
height: 1em;
121120
width: 1em;
122-
fill: currentColor
121+
fill: currentColor;
123122
}
124123

125-
.icon-notice img,
126-
.icon-notice.baseline svg {
124+
.icon-notice img, .icon-notice.baseline svg {
127125
top: .125em;
128-
position: relative
126+
position: relative;
129127
}
130128
</style>
131129
{{- $.Page.Scratch.Set "notice-style-loaded-flag" true -}}

0 commit comments

Comments
 (0)