Skip to content

Commit 456fe74

Browse files
authored
Adjusted markdown alert styles closer to GitHub rendering. (#8185)
1 parent d476971 commit 456fe74

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

pkg/web_css/lib/src/_alerts.scss

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
BSD-style license that can be found in the LICENSE file. */
44

55
.markdown-alert {
6-
margin-top: 1rem;
7-
margin-bottom: 1rem;
8-
padding: 1.25rem;
6+
border-left: 0.25em solid var(--pub-inset-bgColor);
7+
padding: 0.5rem 1rem;
8+
margin: 1rem 0;
99

1010
>:last-child {
1111
margin-bottom: 0;
1212
}
1313

1414
&.markdown-alert-note {
15-
background-color: var(--pub-markdown-alert-info);
15+
border-left-color: var(--pub-markdown-alert-note);
16+
17+
.markdown-alert-title {
18+
color: var(--pub-markdown-alert-note);
19+
}
1620

1721
// NOTE: This is a copy of the dartdoc alert style, for using Material Symbols font.
1822
// TODO: remove or fix this rule
@@ -22,7 +26,11 @@
2226
}
2327

2428
&.markdown-alert-tip {
25-
background-color: var(--pub-markdown-alert-tip);
29+
border-left-color: var(--pub-markdown-alert-tip);
30+
31+
.markdown-alert-title {
32+
color: var(--pub-markdown-alert-tip);
33+
}
2634

2735
// NOTE: This is a copy of the dartdoc alert style, for using Material Symbols font.
2836
// TODO: remove or fix this rule
@@ -32,7 +40,11 @@
3240
}
3341

3442
&.markdown-alert-important {
35-
background-color: var(--pub-markdown-alert-important);
43+
border-left-color: var(--pub-markdown-alert-important);
44+
45+
.markdown-alert-title {
46+
color: var(--pub-markdown-alert-important);
47+
}
3648

3749
// NOTE: This is a copy of the dartdoc alert style, for using Material Symbols font.
3850
// TODO: remove or fix this rule
@@ -42,7 +54,11 @@
4254
}
4355

4456
&.markdown-alert-warning {
45-
background-color: var(--pub-markdown-alert-warning);
57+
border-left-color: var(--pub-markdown-alert-warning);
58+
59+
.markdown-alert-title {
60+
color: var(--pub-markdown-alert-warning);
61+
}
4662

4763
// NOTE: This is a copy of the dartdoc alert style, for using Material Symbols font.
4864
// TODO: remove or fix this rule
@@ -52,7 +68,11 @@
5268
}
5369

5470
&.markdown-alert-caution {
55-
background-color: var(--pub-markdown-alert-error);
71+
border-left-color: var(--pub-markdown-alert-caution);
72+
73+
.markdown-alert-title {
74+
color: var(--pub-markdown-alert-caution);
75+
}
5676

5777
// NOTE: This is a copy of the dartdoc alert style, for using Material Symbols font.
5878
// TODO: remove or fix this rule

pkg/web_css/lib/src/_variables.scss

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
--pub-inset-bgColor: var(--pub-color-smokeWhite);
3232
--pub-selected-bgColor: var(--pub-color-bubblesBlue);
3333

34-
// TODO: adjust colors (copied from dartdoc style) to blend in better with the pub.dev design
35-
--pub-markdown-alert-info: #e7f8ff;
36-
--pub-markdown-alert-tip: #ecfaf7;
37-
--pub-markdown-alert-important: #e2dbff;
38-
--pub-markdown-alert-warning: #fcf8e3;
39-
--pub-markdown-alert-error: #fde9ee;
34+
// Note: these colors are copied from GitHub styles
35+
--pub-markdown-alert-note: #0969da; // accent-emphasis from GitHub
36+
--pub-markdown-alert-tip: #1a7f37; // success-emphasis from GitHub
37+
--pub-markdown-alert-important: #8250df; // done-emphasis from GitHub
38+
--pub-markdown-alert-warning: #9a6700; // attention-emphasis from GitHub
39+
--pub-markdown-alert-caution: #cf222e; // danger-emphasis from GitHub
4040

4141
--pub-default-headline-font_family: "Google Sans Display", "Google Sans", "Roboto", sans-serif;
4242
--pub-default-text-font_family: "Google Sans Text", "Google Sans", "Roboto", sans-serif;
@@ -123,12 +123,12 @@
123123
--pub-inset-bgColor: var(--pub-color-anchorBlack);
124124
--pub-selected-bgColor: var(--pub-color-nipponUltraBlue);
125125

126-
// TODO: adjust colors (copied from dartdoc style) to blend in better with the pub.dev design
127-
--pub-markdown-alert-info: #043875;
128-
--pub-markdown-alert-tip: #065517;
129-
--pub-markdown-alert-important: #4a00b4;
130-
--pub-markdown-alert-warning: #7b6909;
131-
--pub-markdown-alert-error: #7a0c17;
126+
// Note: these colors are copied from GitHub styles
127+
--pub-markdown-alert-note: #0969da; // accent-emphasis from GitHub
128+
--pub-markdown-alert-tip: #1f883d; // success-emphasis from GitHub
129+
--pub-markdown-alert-important: #8250df; // done-emphasis from GitHub
130+
--pub-markdown-alert-warning: #9a6700; // attention-emphasis from GitHub
131+
--pub-markdown-alert-caution: #cf222e; // danger-emphasis from GitHub
132132

133133
--pub-code-text-color: var(--pub-neutral-textColor);
134134
--pub-link-text-color: #40c4ff;

0 commit comments

Comments
 (0)