Skip to content

Commit 4a1a875

Browse files
2bndy5chrisjsewell
andauthored
✨ NEW: Add material design icons roles (#41)
This commit adds 5 new roles, for using Google's Material Design Icons as inline text. Each role represents a different material design "flavor": - `material-regular` - `material-outlined` - `material-sharp` - `material-round` - `material-twotone` Co-authored-by: Chris Sewell <[email protected]>
1 parent 63754db commit 4a1a875

17 files changed

+131785
-8
lines changed

MANIFEST.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ include sphinx_design/compiled/style.min.css
2222
include sphinx_design/compiled/sd_tabs.js
2323
include sphinx_design/compiled/octicon_LICENSE
2424
include sphinx_design/compiled/octicons.json
25+
include sphinx_design/compiled/material_outlined.json
26+
include sphinx_design/compiled/material_regular.json
27+
include sphinx_design/compiled/material_round.json
28+
include sphinx_design/compiled/material_sharp.json
29+
include sphinx_design/compiled/material_twotone.json
30+
include sphinx_design/compiled/material-icons_LICENSE

docs/badges_buttons.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,16 @@ class
175175

176176
## Inline Icons
177177

178-
Inline icon roles are available for both the [GitHub octicon](https://primer.style/octicons/) or [FontAwesome](https://fontawesome.com/icons?d=gallery&m=free) libraries.
178+
Inline icon roles are available for the [GitHub octicon](https://primer.style/octicons/), [Google Material Design Icons](https://github.com/google/material-design-icons), or [FontAwesome](https://fontawesome.com/icons?d=gallery&m=free) libraries.
179179

180-
Octicon icons are added as SVG's directly into the page with the `octicon` role.
180+
Octicon icons and Material icons are added as SVG's directly into the page with the `octicon` and `material-<flavor>` roles. See below for the different flavors of Material Design Icons.
181181

182182
By default the icon will be of height `1em` (i.e. the height of the font).
183183
A specific height can be set after a semi-colon (`;`) with units of either `px`, `em` or `rem`.
184184
Additional CSS classes can also be added to the SVG after a second semi-colon (`;`) delimiter.
185185

186+
### Octicon Icons
187+
186188
A coloured icon: {octicon}`report;1em;sd-text-info`, some more text.
187189

188190
````{tab-set-code}
@@ -201,6 +203,36 @@ A coloured icon: {octicon}`report;1em;sd-text-info`, some more text.
201203
```
202204
````
203205

206+
### Material Design Icons
207+
208+
Material Design icons come as several flavors. Each flavor represents a different role used in sphinx-design. These flavors are:
209+
210+
- `material-regular`
211+
- `material-outlined`
212+
- `material-round`
213+
- `material-sharp`
214+
- `material-twotone`
215+
216+
Not all icons are available for each flavor, but most are. Instead of displaying the 10660+ icons here, you are encouraged to browse the available icons from the [Material Design Icons' showcase](https://fonts.google.com/icons) hosted by Google.
217+
218+
- A regular icon: {material-regular}`data_exploration;2em`, some more text
219+
- A coloured regular icon: {material-regular}`settings;3em;sd-text-success`, some more text.
220+
- A coloured outline icon: {material-outlined}`settings;3em;sd-text-success`, some more text.
221+
- A coloured sharp icon: {material-sharp}`settings;3em;sd-text-success`, some more text.
222+
- A coloured round icon: {material-round}`settings;3em;sd-text-success`, some more text.
223+
- A coloured two-tone icon: {material-twotone}`settings;3em;sd-text-success`, some more text.
224+
225+
````{tab-set-code}
226+
```{literalinclude} ./snippets/myst/icon-material-design.txt
227+
:language: markdown
228+
```
229+
```{literalinclude} ./snippets/rst/icon-material-design.txt
230+
:language: rst
231+
```
232+
````
233+
234+
### FontAwesome Icons
235+
204236
FontAwesome icons are added via the Fontawesome CSS classes.
205237
If the theme you are using does not already include the FontAwesome CSS, it should be loaded in your configuration from a [font-awesome CDN](https://cdnjs.com/libraries/font-awesome), with the [html_css_files](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files) option, e.g.:
206238

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- A regular icon: {material-regular}`data_exploration;2em`, some more text
2+
- A coloured regular icon: {material-regular}`settings;3em;sd-text-success`, some more text.
3+
- A coloured outline icon: {material-outlined}`settings;3em;sd-text-success`, some more text.
4+
- A coloured sharp icon: {material-sharp}`settings;3em;sd-text-success`, some more text.
5+
- A coloured round icon: {material-round}`settings;3em;sd-text-success`, some more text.
6+
- A coloured two-tone icon: {material-twotone}`settings;3em;sd-text-success`, some more text.
7+
- A fixed size icon: {material-regular}`data_exploration;24px`, some more text.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- A regular icon: :material-regular:`data_exploration;2em`, some more text
2+
- A coloured regular icon: :material-regular:`settings;3em;sd-text-success`, some more text.
3+
- A coloured outline icon: :material-outlined:`settings;3em;sd-text-success`, some more text.
4+
- A coloured sharp icon: :material-sharp:`settings;3em;sd-text-success`, some more text.
5+
- A coloured round icon: :material-round:`settings;3em;sd-text-success`, some more text.
6+
- A coloured two-tone icon: :material-twotone:`settings;3em;sd-text-success`, some more text.
7+
- A fixed size icon: :material-regular:`data_exploration;24px`, some more text.

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ exclude =
4444
code_style =
4545
pre-commit~=2.12
4646
rtd =
47-
myst-parser~=0.15.0
47+
myst-parser~=0.16.0
4848
testing =
49-
myst-parser~=0.15.0
49+
myst-parser~=0.16.0
5050
pytest~=6.2
5151
pytest-cov
5252
pytest-regressions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2021 Google
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

0 commit comments

Comments
 (0)