Skip to content

Commit

Permalink
Merge pull request #32 from MDAnalysis/update-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyminium authored Sep 4, 2023
2 parents 1262f69 + 85012ba commit 3935421
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 21 deletions.
20 changes: 14 additions & 6 deletions mdanalysis_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@
{% set show_sphinx = "False" %}

{% block sidebartitle %}
{% set _logo_url = '_static/logo/placeholder_logo.png' %}

{% if theme_mda_official|tobool %}
{% set _logo_url = '_static/logo/mda_logo.png' %}
{% elif theme_logo_url|tobool %}
{% set _logo_url = theme_logo_url %}
{% set _logo_url = "" %}

{% if logo_url %}
{% set _logo_url = logo_url %}
{% elif logo %}
{% set _logo_url = pathto("_static/" + logo, 1) %}
{% elif theme_mda_official %}
{% set _logo_url = pathto('_static/logo/mda_logo.png', 1) %}
{% else %}
{% set _logo_url = '' %}
{% endif %}


{% set _root_doc = root_doc|default(master_doc) %}
<a href="{{ pathto(_root_doc) }}"{% if not theme_logo_only %} class="icon icon-home"{% endif %}>
{% if not theme_logo_only %}{{ project }}{% endif %}
<img src="{{ pathto(_logo_url, 1) }}" class="logo" alt="{{ _('Logo') }}"/>
{%- if _logo_url != "" %}
<img src="{{ _logo_url }}" class="logo" alt="{{ _('Logo') }}"/>
{%- endif %}
</a>

{% if theme_display_version %}
Expand Down
25 changes: 16 additions & 9 deletions mdanalysis_sphinx_theme/sass/admonitions.sass
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
[dir="rtl"] &
border-right-color: $color

// Text color
color: $white

// Admonition icon
&::before
// color: $color
color: $white
font-family: $font
content: $unicode

strong
color: $white


.admonition, div.deprecated, div.alert
margin: $admonition-margin 0
padding: 0 0.75rem
Expand Down Expand Up @@ -63,9 +70,9 @@
max-width: calc(80ex - 2 * #{$admonition-margin})

&.note, &.admonition-note
@include material_admonitions($grey, "FontAwesome", "\f05a")
@include material_admonitions($mdanalysis-gray, "FontAwesome", "\f05a")
&.seealso, &.admonition-seealso
@include material_admonitions($grey, "FontAwesome", "\f06e")
@include material_admonitions($mdanalysis-gray, "FontAwesome", "\f06e")
&.admonition-abstract, &.admonition-summary, &.admonition-tldr
@include material_admonitions($cyan, "FontAwesome", "\f543")
&.admonition-info, &.alert-info
Expand All @@ -75,15 +82,15 @@
&.tip, &.hint, &.admonition-tip, &.admonition-hint
@include material_admonitions($turquoise, "FontAwesome", "\f06d")
&.important, &.admonition-important
@include material_admonitions($green, "FontAwesome", "\f06a")
@include material_admonitions($mdanalysis-orange, "FontAwesome", "\f06a")
&.admonition-success, &.admonition-check, &.admonition-done, &.alert-success
@include material_admonitions($green, "FontAwesome", "\f058")
&.admonition-question, &.admonition-help, &.admonition-faq
@include material_admonitions($cyan, "FontAwesome", "\f059")
&.warning, &.caution, &.attention, &.admonition-warning, &.admonition-caution, &.admonition-attention
@include material_admonitions($orange, "FontAwesome", "\f071")
@include material_admonitions($mdanalysis-orange, "FontAwesome", "\f071")
&.attention, &.admonition-attention, &.alert-warning
@include material_admonitions($yellow, "FontAwesome", "\f071")
@include material_admonitions($mdanalysis-orange, "FontAwesome", "\f071")
&.error, &.admonition-failure, &.admonition-fail, &.admonition-missing, &.admonition-error
@include material_admonitions($mdanalysis-orange-red, "FontAwesome", "\f057")
&.danger, &.admonition-danger, &.alert-danger
Expand All @@ -93,11 +100,11 @@
&.admonition-example
@include material_admonitions($blue, "FontAwesome", "\f0c5")
&.admonition-quote, &.admonition-cite
@include material_admonitions($grey, "FontAwesome", "\f10e")
@include material_admonitions($mdanalysis-gray, "FontAwesome", "\f10e")
&.deprecated, &.admonition-deprecated
@include material_admonitions($yellow, "FontAwesome", "\f017")
@include material_admonitions($mdanalysis-gray, "FontAwesome", "\f017")
&.experimental, &.admonition-experimental, &.admonition-experiment, &.admonition-experiments
@include material_admonitions($yellow, "FontAwesome", "\f492")
@include material_admonitions($mdanalysis-orange, "FontAwesome", "\f492")

// Differences between deprecated and admonitions
div.deprecated > p
Expand Down Expand Up @@ -138,7 +145,7 @@ div.deprecated > p
left: 0.75rem
width: 1.25rem
height: 1.25rem
color: $accent
// color: $accent
font-family: "FontAwesome"
content: "\f12a"

Expand Down
16 changes: 15 additions & 1 deletion mdanalysis_sphinx_theme/sass/material-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ blockquote {
display: flow-root;
padding-left: px2rem(12px);
color: $grey-dark;
border-left: px2rem(4px) solid $grey;
// border-left: px2rem(4px) solid $grey;

// Adjust for right-to-left languages
[dir="rtl"] & {
Expand All @@ -322,6 +322,20 @@ blockquote {
}
}

// No border for block quotes inside a list,
// these are probably sub items
li > blockquote {
border-left: none;

// Adjust for right-to-left languages
[dir="rtl"] & {
border-right: none;
}
}

// No border for blockquotes that *are* a list...
blockquote

// Unordered list
ul {
list-style-type: disc;
Expand Down
19 changes: 19 additions & 0 deletions mdanalysis_sphinx_theme/sass/mdanalysis-sphinx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,23 @@ code {
white-space: inherit;
}
}
}

// fix for dataTables
// https://github.com/readthedocs/sphinx_rtd_theme/issues/1287#issuecomment-1094920765

.dataTables_wrapper.no-footer .wy-table-responsive {
overflow: unset;
}

// fix header whitespace, there's a lot of it
div[role=navigation] > .wy-breadcrumbs {
margin: 0;

.breadcrumb-item {
margin-top: 0;
margin-bottom: 0;
padding-top: 0;
padding-bottom: 0;
}
}
8 changes: 4 additions & 4 deletions mdanalysis_sphinx_theme/sass/sphinx-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ a.brackets {
}
>.output_area, >.input_area {
border: None !important;
@include z-depth(2);
@include z-depth(1);
}
.highlight {
width: 100%;
Expand All @@ -432,7 +432,7 @@ a.brackets {
}
// Stdin cell
>.input_area {
border-left: medium green solid !important;
border-left: medium $mdanalysis-gray solid !important;
pre {
padding: 1.25rem 1.5rem !important;
}
Expand All @@ -446,12 +446,12 @@ a.brackets {
}
// Stderr cell
>.stderr.output_area {
border-left: medium gray solid !important;
border-left: medium $grey-light solid !important;
background: #fee !important;
}
// Stdout cell
>:not(.stderr).output_area {
border-left: medium gray solid !important;
border-left: medium $grey-light solid !important;
background: $body-background-color !important;
}
}
Expand Down
8 changes: 8 additions & 0 deletions mdanalysis_sphinx_theme/sass/utilities/_z-depth.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
box-shadow: none;
}

@mixin z-depth-1dp($color) {
box-shadow: 0 2px 2px 0 rgba($color, .35 * alpha($color)),
0 2px 2px 0 rgba($color, .3 * alpha($color)),
0 3px 1px -2px rgba($color, .5 * alpha($color));
}

@mixin z-depth-2dp($color) {
box-shadow: 0 2px 2px 0 rgba($color, .35 * alpha($color)),
0 1px 5px 0 rgba($color, .3 * alpha($color)),
Expand Down Expand Up @@ -95,6 +101,8 @@
@mixin z-depth($dp: 2, $color: rgba(black, .4)) {
@if $dp == 0 {
@include z-depth-0dp($color);
} @else if $dp == 1 {
@include z-depth-1dp($color);
} @else if $dp == 2 {
@include z-depth-2dp($color);
} @else if $dp == 3 {
Expand Down
12 changes: 11 additions & 1 deletion mdanalysis_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,18 @@ stylesheet = site.css

[options]
logo_only = True
display_version = True
prev_next_buttons_location = bottom
style_external_links = False
style_nav_header_background = white
collapse_navigation = True
sticky_navigation = True
navigation_depth = 4
includehidden = True
titles_only = False

mda_official = False
base_url =
repo_name =
repo_url =
color_accent = mdanalysis-orange
color_accent = mdanalysis-orange

0 comments on commit 3935421

Please sign in to comment.