From f9298cf91f6ff88a90035dec1174b4c7093b5e8a Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 13 Jun 2018 10:18:00 +0200 Subject: [PATCH] Added support for theme color on Android --- CHANGELOG | 5 +++ docs/release-notes.md | 7 ++++ material/base.html | 7 +++- material/partials/palette.html | 39 +++++++++++++++++++++ package-lock.json | 2 +- package.json | 2 +- src/base.html | 7 ++++ src/partials/palette.html | 64 ++++++++++++++++++++++++++++++++++ 8 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 material/partials/palette.html create mode 100644 src/partials/palette.html diff --git a/CHANGELOG b/CHANGELOG index 1f57bc1a6..f775fec9c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +mkdocs-material-2.9.0 (2018-06-13) + + * Added support for theme color on Android + * Fixed #796: Rendering of nested tabbed code blocks + mkdocs-material-2.8.0 (2018-06-10) * Added support for grouping code blocks with tabs diff --git a/docs/release-notes.md b/docs/release-notes.md index 386d116e4..4a3488320 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -37,6 +37,13 @@ pip show mkdocs-material ## Changelog +### 2.9.0 _ June 13, 2018 + +* Added support for theme color on Android +* Fixed [#796][796] Rendering of nested tabbed code blocks + + [796]: https://github.com/squidfunk/mkdocs-material/issues/796 + ### 2.8.0 _ June 10, 2018 * Added support for grouping code blocks with tabs diff --git a/material/base.html b/material/base.html index 67caca528..34111ad6b 100644 --- a/material/base.html +++ b/material/base.html @@ -36,7 +36,7 @@ {% endfor %} - + {% endblock %} {% block htmltitle %} {% if page and page.meta and page.meta.title %} @@ -52,6 +52,11 @@ {% if palette.primary or palette.accent %} {% endif %} + {% if palette.primary %} + {% import "partials/palette.html" as map %} + {% set color = map.primary(palette.primary) %} + + {% endif %} {% endblock %} {% block libs %} diff --git a/material/partials/palette.html b/material/partials/palette.html new file mode 100644 index 000000000..a1bc0bc39 --- /dev/null +++ b/material/partials/palette.html @@ -0,0 +1,39 @@ +{% macro primary(key) %}{{ { + "red": "#ef5350", + "pink": "#e91e63", + "purple": "#ab47bc", + "deep-purple": "#7e57c2", + "indigo": "#3f51b5", + "blue": "#2196f3", + "light-blue": "#03a9f4", + "cyan": "#00bcd4", + "teal": "#009688", + "green": "#4caf50", + "light-green": "#7cb342", + "lime": "#c0ca33", + "yellow": "#f9a825", + "amber": "#ffa000", + "orange": "#fb8c00", + "deep-orange": "#ff7043", + "brown": "#795548", + "grey": "#757575", + "blue-grey": "#546e7a" +}[key] }}{% endmacro %} +{% macro accent(key) %}{{ { + "red": "#ff1744", + "pink": "#f50057", + "purple": "#e040fb", + "deep-purple": "#7c4dff", + "indigo": "#536dfe", + "blue": "#448aff", + "light-blue": "#0091ea", + "cyan": "#00b8d4", + "teal": "#00bfa5", + "green": "#00c853", + "light-green": "#64dd17", + "lime": "#aeea00", + "yellow": "#ffd600", + "amber": "#ffab00", + "orange": "#ff9100", + "deep-orange": "#ff6e40" +}[key] }}{% endmacro %} diff --git a/package-lock.json b/package-lock.json index 502ca4869..91098e480 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mkdocs-material", - "version": "2.7.3", + "version": "2.9.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 7889fb901..39a13af91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mkdocs-material", - "version": "2.8.0", + "version": "2.9.0", "description": "A Material Design theme for MkDocs", "keywords": [ "mkdocs", diff --git a/src/base.html b/src/base.html index c3d777e80..73faecfa1 100644 --- a/src/base.html +++ b/src/base.html @@ -106,6 +106,13 @@ {% endif %} + + + {% if palette.primary %} + {% import "partials/palette.html" as map %} + {% set color = map.primary(palette.primary) %} + + {% endif %} {% endblock %} diff --git a/src/partials/palette.html b/src/partials/palette.html new file mode 100644 index 000000000..5f2c01969 --- /dev/null +++ b/src/partials/palette.html @@ -0,0 +1,64 @@ + + + +{% macro primary(key) %}{{ { + "red": "#ef5350", + "pink": "#e91e63", + "purple": "#ab47bc", + "deep-purple": "#7e57c2", + "indigo": "#3f51b5", + "blue": "#2196f3", + "light-blue": "#03a9f4", + "cyan": "#00bcd4", + "teal": "#009688", + "green": "#4caf50", + "light-green": "#7cb342", + "lime": "#c0ca33", + "yellow": "#f9a825", + "amber": "#ffa000", + "orange": "#fb8c00", + "deep-orange": "#ff7043", + "brown": "#795548", + "grey": "#757575", + "blue-grey": "#546e7a" +}[key] }}{% endmacro %} + + +{% macro accent(key) %}{{ { + "red": "#ff1744", + "pink": "#f50057", + "purple": "#e040fb", + "deep-purple": "#7c4dff", + "indigo": "#536dfe", + "blue": "#448aff", + "light-blue": "#0091ea", + "cyan": "#00b8d4", + "teal": "#00bfa5", + "green": "#00c853", + "light-green": "#64dd17", + "lime": "#aeea00", + "yellow": "#ffd600", + "amber": "#ffab00", + "orange": "#ff9100", + "deep-orange": "#ff6e40" +}[key] }}{% endmacro %}