Added support for theme color on Android

This commit is contained in:
squidfunk 2018-06-13 10:18:00 +02:00
parent 87f9a3a25b
commit f9298cf91f
8 changed files with 130 additions and 3 deletions

View File

@ -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

View File

@ -37,6 +37,13 @@ pip show mkdocs-material
## Changelog
### 2.9.0 <small>_ June 13, 2018</small>
* 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 <small>_ June 10, 2018</small>
* Added support for grouping code blocks with tabs

View File

@ -36,7 +36,7 @@
<meta name="lang:{{ key }}" content="{{ lang.t(key) }}">
{% endfor %}
<link rel="shortcut icon" href="{{ base_url }}/{{ config.theme.favicon }}">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-2.8.0">
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-2.9.0">
{% endblock %}
{% block htmltitle %}
{% if page and page.meta and page.meta.title %}
@ -52,6 +52,11 @@
{% if palette.primary or palette.accent %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-palette.6079476c.css">
{% endif %}
{% if palette.primary %}
{% import "partials/palette.html" as map %}
{% set color = map.primary(palette.primary) %}
<meta name="theme-color" content="{{ color }}">
{% endif %}
{% endblock %}
{% block libs %}
<script src="{{ base_url }}/assets/javascripts/modernizr.1aa3b519.js"></script>

View File

@ -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 %}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "mkdocs-material",
"version": "2.7.3",
"version": "2.9.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "mkdocs-material",
"version": "2.8.0",
"version": "2.9.0",
"description": "A Material Design theme for MkDocs",
"keywords": [
"mkdocs",

View File

@ -106,6 +106,13 @@
<link rel="stylesheet" type="text/css"
href="{{ base_url }}/assets/stylesheets/application-palette.css" />
{% endif %}
<!-- Theme-color meta tag for Android -->
{% if palette.primary %}
{% import "partials/palette.html" as map %}
{% set color = map.primary(palette.primary) %}
<meta name="theme-color" content="{{ color }}" />
{% endif %}
{% endblock %}
<!-- JavaScript libraries -->

64
src/partials/palette.html Normal file
View File

@ -0,0 +1,64 @@
<!--
Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<!-- Primary colors -->
{% 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 %}
<!-- Accent colors -->
{% 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 %}