You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+92-83Lines changed: 92 additions & 83 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,125 +4,134 @@
4
4
5
5
Phosphor is a flexible icon family for interfaces, diagrams, presentations — whatever, really. Explore all our icons at [phosphoricons.com](https://phosphoricons.com).
[](https://github.com/rektdeckard)
13
13
14
14
## Usage
15
15
16
16
### Getting Started
17
17
18
-
We use a similar approach as many other icon sets out there, providing icons as a webfont that uses Unicode's Private Use Area character codes to map normally non-rendering characters to icons. But you don't need to know that. All you need to do is add the script to the document `<head>`, and drop in icons with an `<i/>` tag and the appropriate class:
18
+
We use a similar approach as many other icon sets out there, providing icons as several webfonts that uses Unicode's Private Use Area character codes to map normally non-rendering characters to icons. Simply add one or more weights by including its stylesheet to the document `<head>`, and drop in icons with an `<i>` tag and the appropriate classes for the weight and the icon:
> **Note:**For stability, you may choose to source a specific version of Phosphor by adding the version to the script URL, for example: `https://unpkg.com/phosphor-icons@1.3.2`. The CDN supports version ranges.
38
+
> **Note:**You can import as many or as few weights as needed. Only imported weights will match and render as icons.
35
39
36
-
### Styling
40
+
### Weights
41
+
42
+
Phosphor Icons come in 6 weights: `regular`, `thin`, `light`, `bold`, `fill`, and `duotone`. In order to use a weight, you must include a link to its stylesheet, and use the appropriate weight class on the icon (the `regular` weight uses `.ph` instead of `.ph-regular`):
Since the icons are just text under the hood, they can be colored and styled with CSS like any other font, including `font-size`, `color`, etc. We include several helper classes to provide easy sizing if you need it:
39
-
40
-
```css
41
-
.ph-xxs {
42
-
font-size: 0.5em;
43
-
}
44
-
.ph-xs {
45
-
font-size: 0.75em;
46
-
}
47
-
.ph-sm {
48
-
font-size: 0.875em;
49
-
}
50
-
.ph-lg {
51
-
font-size: 1.3333em;
52
-
line-height: 0.75em;
53
-
vertical-align: -0.0667em;
54
-
}
55
-
.ph-xl {
56
-
font-size: 1.5em;
57
-
line-height: 0.6666em;
58
-
vertical-align: -0.075em;
59
-
}
60
-
.ph-1x {
61
-
font-size: 1em;
62
-
}
63
-
.ph-2x {
64
-
font-size: 2em;
65
-
}
66
-
.ph-3x {
67
-
font-size: 3em;
68
-
}
69
-
.ph-4x {
70
-
font-size: 4em;
71
-
}
72
-
.ph-5x {
73
-
font-size: 5em;
74
-
}
75
-
.ph-6x {
76
-
font-size: 6em;
77
-
}
78
-
.ph-7x {
79
-
font-size: 7em;
80
-
}
81
-
.ph-8x {
82
-
font-size: 8em;
83
-
}
84
-
.ph-9x {
85
-
font-size: 9em;
86
-
}
87
-
.ph-10x {
88
-
font-size: 10em;
89
-
}
90
-
.ph-fw {
91
-
text-align: center;
92
-
width: 1.25em;
93
-
}
67
+
> **NOTE:** Though assets will be cached for subsequent loads, this will bring in around 3MB of fonts and CSS, and may have impact on page load speed.
68
+
69
+
### Modules
70
+
71
+
If your environment supports loading CSS files as modules, icon weights can be imported for effect from the package.
72
+
73
+
```sh
74
+
$ yarn add @phosphor-icons/web
94
75
```
95
76
96
-
> **Note:** Overriding the `font-family`, `font-style`, `font-weight`, `font-variant`, or `text-transform` may break the icons and render unprintable characters. Don't do it.
77
+
```js
78
+
import"@phosphor-icons/web/light";
79
+
import"@phosphor-icons/web/bold";
80
+
```
97
81
98
-
> **Note:** The `duotone` weight is not yet available for this implementation, as fonts do not support baked-in alpha/opacity. In future we plan to move to an SVG-based approach with full support for all icon weights.
82
+
### Styling
99
83
100
-
### Ligatures
84
+
Since the icons are just text under the hood, they can be colored and styled with CSS like any other font, including `font-size`, `color`, etc.
101
85
102
-
The icon font now supports ligatures, meaning that in any text using `font-family: "Phosphor"`, writing the name of an icon (without the `ph-` prefix) will convert to the corresponding icon. The largest possible string will be matched, meaning you can use any available weight, and print multiple icons without separating with spaces or other characters if you choose.
86
+
```html
87
+
<style>
88
+
.ph-bold {
89
+
font-size: 48px;
90
+
}
91
+
92
+
.green {
93
+
color: limegreen;
94
+
}
95
+
</style>
96
+
...
97
+
<!-- 96px -->
98
+
<iclass="ph-bold ph-airplane"></i>
99
+
<!-- 96px and green -->
100
+
<iclass="ph-bold ph-skull green"></i>
101
+
```
102
+
103
+
> **Note:** Overriding the `font-family`, `font-style`, `font-weight`, `font-variant`, or `text-transform` may break the icons and render unprintable characters. Don't do it. Additionally, all weights use the `:before` pseudoelement to inject the font glyph, so overriding this property in icon classes can break them. The `duotone` weight also uses the `:after` pseudoelement, so it is best not to modify either when styling icons.
104
+
105
+
<!-- ### Ligatures
106
+
107
+
All weights aside from `duotone` support ligatures, meaning that in any text using supported weight classes, writing the name of an icon (without the `ph-` prefix) will convert to the corresponding icon. The largest possible string will be matched, meaning you can use any available weight, and print multiple icons without separating with spaces or other characters if you choose.
0 commit comments