Skip to content

Commit a6229eb

Browse files
committed
Improved admonition differentiation
Addresses #28 and #6. To do this, explicit styling was applied for the different admonition types. The Sphinx RTD theme uses the same styling for the following groups: - blue: note, custom admonitions, seealso - red: danger, error - yellow: attention, caution, danger - green: tip, hint, important Because Alabaster's default aesthetics are not as shiny, we use the following instead: - gray: note, custom admonitions, seealso - pink with darker pink shadow: danger, error - pink: attention, caution, danger - gray: tip, hint, important In addition, the different admonition styles are separated into a better set of comments for their readability.
1 parent c26d0bf commit a6229eb

File tree

2 files changed

+108
-6
lines changed

2 files changed

+108
-6
lines changed

alabaster/static/alabaster.css_t

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,45 @@
44
{% set theme_sidebar_link = theme_sidebar_link or theme_gray_1 %}
55
{% set theme_anchor_hover_fg = theme_anchor_hover_fg or theme_gray_1 %}
66

7-
{% set theme_note_bg = theme_note_bg or theme_gray_2 %}
87
{% set theme_footnote_border = theme_footnote_border or theme_gray_2 %}
98
{% set theme_pre_bg = theme_pre_bg or theme_gray_2 %}
109

10+
11+
{# set up admonition styling #}
12+
{# - basic level #}
1113
{% set admonition_xref_bg = theme_admonition_xref_bg or theme_xref_bg %}
14+
{% set theme_admonition_bg = theme_admonition_bg or theme_gray_2 %}
15+
{% set theme_note_bg = theme_note_bg or theme_gray_2 %}
16+
{% set theme_seealso_bg = theme_seealso_bg or theme_gray_2 %}
17+
18+
{# - critical level #}
19+
{% set theme_danger_bg = theme_danger_bg or theme_pink_1 %}
20+
{% set theme_danger_border = theme_danger_border or theme_pink_2 %}
21+
{% set theme_danger_shadow = theme_danger_shadow or theme_pink_3 %}
22+
23+
{% set theme_error_bg = theme_error_bg or theme_pink_1 %}
24+
{% set theme_error_border = theme_error_border or theme_pink_2 %}
25+
{% set theme_error_shadow = theme_error_shadow or theme_pink_3 %}
26+
27+
{# - warning level #}
28+
{% set theme_caution_bg = theme_caution_bg or theme_pink_1 %}
29+
{% set theme_caution_border = theme_caution_border or theme_pink_2 %}
30+
31+
{% set theme_attention_bg = theme_attention_bg or theme_pink_1 %}
32+
{% set theme_attention_border = theme_attention_border or theme_pink_2 %}
1233

1334
{% set theme_warn_bg = theme_warn_bg or theme_pink_1 %}
1435
{% set theme_warn_border = theme_warn_border or theme_pink_2 %}
1536

37+
{# - normal level #}
38+
{% set theme_important_bg = theme_important_bg or theme_gray_2 %}
39+
{% set theme_tip_bg = theme_tip_bg or theme_gray_2 %}
40+
{% set theme_hint_bg = theme_hint_bg or theme_gray_2 %}
41+
42+
{# /set up admonition styling #}
43+
1644
{% set theme_shadow = theme_shadow or theme_gray_2 %}
1745

18-
{% set theme_seealso_bg = theme_seealso_bg or theme_gray_2 %}
1946

2047
{% set theme_topic_bg = theme_topic_bg or theme_gray_2 %}
2148

@@ -240,8 +267,8 @@ div.body p, div.body dd, div.body li {
240267
div.admonition {
241268
margin: 20px 0px;
242269
padding: 10px 30px;
243-
background-color: {{ theme_warn_bg }};
244-
border: 1px solid {{ theme_warn_border }};
270+
background-color: {{ theme_admonition_bg }};
271+
border: 1px solid {{ theme_admonition_border }};
245272
}
246273

247274
div.admonition tt.xref, div.admonition code.xref, div.admonition a tt {
@@ -275,11 +302,57 @@ dt:target, .highlight {
275302
background: {{ theme_highlight_bg }};
276303
}
277304

305+
div.warning {
306+
background-color: {{ theme_warn_bg }};
307+
border: 1px solid {{ theme_warn_border }};
308+
}
309+
310+
div.danger {
311+
background-color: {{ theme_danger_bg }};
312+
border: 1px solid {{ theme_danger_border }};
313+
-moz-box-shadow: 2px 2px 4px {{ theme_danger_shadow }};
314+
-webkit-box-shadow: 2px 2px 4px {{ theme_danger_shadow }};
315+
box-shadow: 2px 2px 4px {{ theme_danger_shadow }};
316+
}
317+
318+
div.error {
319+
background-color: {{ theme_error_bg }};
320+
border: 1px solid {{ theme_error_border }};
321+
-moz-box-shadow: 2px 2px 4px {{ theme_error_shadow }};
322+
-webkit-box-shadow: 2px 2px 4px {{ theme_error_shadow }};
323+
box-shadow: 2px 2px 4px {{ theme_error_shadow }};
324+
}
325+
326+
div.caution {
327+
background-color: {{ theme_caution_bg }};
328+
border: 1px solid {{ theme_caution_border }};
329+
}
330+
331+
div.attention {
332+
background-color: {{ theme_attention_bg }};
333+
border: 1px solid {{ theme_attention_border }};
334+
}
335+
336+
div.important {
337+
background-color: {{ theme_important_bg }};
338+
border: 1px solid {{ theme_important_border }};
339+
}
340+
278341
div.note {
279342
background-color: {{ theme_note_bg }};
280343
border: 1px solid {{ theme_note_border }};
281344
}
282345

346+
div.tip {
347+
background-color: {{ theme_tip_bg }};
348+
border: 1px solid {{ theme_tip_border }};
349+
}
350+
351+
div.hint {
352+
background-color: {{ theme_hint_bg }};
353+
border: 1px solid {{ theme_hint_border }};
354+
}
355+
283356
div.seealso {
284357
background-color: {{ theme_seealso_bg }};
285358
border: 1px solid {{ theme_seealso_border }};

alabaster/theme.conf

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ gray_3 = #AAA
3434

3535
pink_1 = #FCC
3636
pink_2 = #FAA
37+
pink_3 = #D52C2C
3738

3839
base_bg = #fff
3940
base_text = #000
@@ -56,19 +57,47 @@ anchor_hover_fg =
5657
anchor_hover_bg = #EAEAEA
5758
table_border = #888
5859
shadow =
60+
61+
# Admonition options
62+
## basic level
63+
admonition_bg =
64+
admonition_border = #CCC
5965
note_bg =
6066
note_border = #CCC
6167
seealso_bg =
6268
seealso_border = #CCC
69+
70+
## critical level
71+
danger_bg =
72+
danger_border =
73+
danger_shadow =
74+
error_bg =
75+
error_border =
76+
error_shadow =
77+
78+
## normal level
79+
tip_bg =
80+
tip_border = #CCC
81+
hint_bg =
82+
hint_border = #CCC
83+
important_bg =
84+
important_border = #CCC
85+
86+
## warning level
87+
caution_bg =
88+
caution_border =
89+
attention_bg =
90+
attention_border =
91+
warn_bg =
92+
warn_border =
93+
6394
topic_bg =
6495
code_highlight_bg =
6596
highlight_bg = #FAF3E8
6697
xref_border = #fff
6798
xref_bg = #FBFBFB
6899
admonition_xref_border = #fafafa
69100
admonition_xref_bg =
70-
warn_bg =
71-
warn_border =
72101
footnote_bg = #FDFDFD
73102
footnote_border =
74103
pre_bg =

0 commit comments

Comments
 (0)