Skip to content

Commit 1fb24cd

Browse files
authored
Merge pull request #13 from phosphor-icons/revamp
feat(lib): update assets to v2.0.0 and split weights
2 parents ef44a96 + ee51e53 commit 1fb24cd

File tree

6,333 files changed

+38063
-211187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,333 files changed

+38063
-211187
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "core"]
2+
path = core
3+
url = https://github.com/phosphor-icons/core
4+
branch = main

README.md

Lines changed: 92 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,125 +4,134 @@
44

55
Phosphor is a flexible icon family for interfaces, diagrams, presentations — whatever, really. Explore all our icons at [phosphoricons.com](https://phosphoricons.com).
66

7-
[![NPM](https://img.shields.io/npm/v/phosphor-icons.svg?style=flat-square)](https://www.npmjs.com/package/phosphor-icons) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com) [![Travis](https://img.shields.io/travis/com/rektdeckard/phosphor-icons.svg?style=flat-square)](https://travis-ci.com/github/rektdeckard/phosphor-icons)
7+
[![NPM](https://img.shields.io/npm/v/@phosphor-icons/web.svg?style=flat-square)](https://www.npmjs.com/package/!phosphor-icons/web) [![Travis](https://img.shields.io/travis/com/phosphor-icons/web.svg?style=flat-square)](https://travis-ci.com/github/phosphor-icons/web)
88

9-
[![GitHub stars](https://img.shields.io/github/stars/phosphor-icons/phosphor-icons?style=flat-square&label=Star)](https://github.com/phosphor-icons/phosphor-icons)
10-
[![GitHub forks](https://img.shields.io/github/forks/phosphor-icons/phosphor-icons?style=flat-square&label=Fork)](https://github.com/phosphor-icons/phosphor-icons/fork)
11-
[![GitHub watchers](https://img.shields.io/github/watchers/phosphor-icons/phosphor-icons?style=flat-square&label=Watch)](https://github.com/phosphor-icons/phosphor-icons)
9+
[![GitHub stars](https://img.shields.io/github/stars/phosphor-icons/web?style=flat-square&label=Star)](https://github.com/phosphor-icons/web)
10+
[![GitHub forks](https://img.shields.io/github/forks/phosphor-icons/web?style=flat-square&label=Fork)](https://github.com/phosphor-icons/web/fork)
11+
[![GitHub watchers](https://img.shields.io/github/watchers/phosphor-icons/web?style=flat-square&label=Watch)](https://github.com/phosphor-icons/web)
1212
[![Follow on GitHub](https://img.shields.io/github/followers/rektdeckard?style=flat-square&label=Follow)](https://github.com/rektdeckard)
1313

1414
## Usage
1515

1616
### Getting Started
1717

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:
1919

2020
```html
2121
<!DOCTYPE html>
2222
<html>
2323
<head>
24-
<script src="https://unpkg.com/phosphor-icons"></script>
24+
<link
25+
rel="stylesheet"
26+
type="text/css"
27+
href="https://unpkg.com/@phosphor-icons/web@2.0.1/src/bold/style.css"
28+
/>
2529
</head>
2630
<body>
27-
<i class="ph-smiley"></i>
28-
<i class="ph-heart-fill" style="color: hotpink"></i>
29-
<i class="ph-cube-thin"></i>
31+
<i class="ph-bold ph-smiley"></i>
32+
<i class="ph-bold ph-heart" style="color: hotpink"></i>
33+
<i class="ph-bold ph-cube"></i>
3034
</body>
3135
</html>
3236
```
3337

34-
> **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.
3539
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`):
43+
44+
```html
45+
<link
46+
rel="stylesheet"
47+
type="text/css"
48+
href="https://unpkg.com/@phosphor-icons/web@2.0.1/src/duotone/style.css"
49+
/>
50+
...
51+
<i class="ph-duotone ph-baseball"></i>
52+
```
53+
54+
The URL format is `https://unpkg.com/@phosphor-icons/web@<VERSION>/src/<WEIGHT>/style.css`. Other common CDNs may also be used.
55+
56+
#### Using All Weights
57+
58+
If you intend to use all 6 weights, they can be made available by including the library as a script tag, using the base URL:
59+
60+
```html
61+
<script src="https://unpkg.com/@phosphor-icons/web@2.0.1"></script>
62+
...
63+
<i class="ph-light ph-address-book"></i>
64+
<i class="ph ph-sunglasses"></i>
65+
```
3766

38-
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
9475
```
9576

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+
```
9781

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
9983

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.
10185

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+
<i class="ph-bold ph-airplane"></i>
99+
<!-- 96px and green -->
100+
<i class="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.
103108
104109
```html
105110
<!DOCTYPE html>
106111
<html>
107112
<head>
108-
<script src="https://unpkg.com/phosphor-icons"></script>
113+
<link
114+
rel="stylesheet"
115+
type="text/css"
116+
href="https://unpkg.com/@phosphor-icons/web@2.0.1/src/bold/style.css"
117+
/>
109118
</head>
110119
<body>
111-
<!-- Renders as sword and shield icons -->
112-
<p style="font-family: Phosphor">sword-fill shield</p>
120+
<p class="ph-bold">sword shield</p>
113121
</body>
114122
</html>
115-
```
123+
``` -->
116124

117125
## Our Related Projects
118126

119-
- [phosphor-home](https://github.com/phosphor-icons/phosphor-home) ▲ Phosphor homepage and general info
120-
- [phosphor-react](https://github.com/phosphor-icons/phosphor-react) ▲ Phosphor icon component library for React
121-
- [phosphor-vue](https://github.com/phosphor-icons/phosphor-vue) ▲ Phosphor icon component library for Vue
122-
- [phosphor-flutter](https://github.com/phosphor-icons/phosphor-flutter) ▲ Phosphor IconData library for Flutter
123-
- [phosphor-webcomponents](https://github.com/phosphor-icons/phosphor-webcomponents) ▲ Phosphor icons as Web Components
124-
- [phosphor-figma](https://github.com/phosphor-icons/phosphor-figma) ▲ Phosphor icons Figma plugin
125-
- [phosphor-sketch](https://github.com/phosphor-icons/phosphor-sketch) ▲ Phosphor icons Sketch plugin
127+
- [@phosphor-icons/homepage](https://github.com/phosphor-icons/homepage) ▲ Phosphor homepage and general info
128+
- [@phosphor-icons/react](https://github.com/phosphor-icons/react) ▲ Phosphor icon component library for React
129+
- [@phosphor-icons/vue](https://github.com/phosphor-icons/vue) ▲ Phosphor icon component library for Vue
130+
- [@phosphor-icons/flutter](https://github.com/phosphor-icons/flutter) ▲ Phosphor IconData library for Flutter
131+
- [@phosphor-icons/elm](https://github.com/phosphor-icons/phosphor-elm) ▲ Phosphor icon library for Elm
132+
- [@phosphor-icons/webcomponents](https://github.com/phosphor-icons/webcomponents) ▲ Phosphor icons as Web Components
133+
- [@phosphor-icons/figma](https://github.com/phosphor-icons/figma) ▲ Phosphor icons Figma plugin
134+
- [@phosphor-icons/sketch](https://github.com/phosphor-icons/sketch) ▲ Phosphor icons Sketch plugin
126135

127136
## Community Projects
128137

@@ -131,7 +140,7 @@ The icon font now supports ligatures, meaning that in any text using `font-famil
131140
- [phosphor-r](https://github.com/dreamRs/phosphoricons) ▲ Phosphor icon wrapper for R documents and applications
132141
- [blade-phosphor-icons](https://github.com/codeat3/blade-phosphor-icons) ▲ Phosphor icons in your Laravel Blade views
133142

134-
If you've made a port of Phosphor and you want to see it here, just open a PR [here](https://github.com/phosphor-icons/phosphor-home)!
143+
If you've made a port of Phosphor and you want to see it here, just open a PR [here](https://github.com/phosphor-icons/homepage)!
135144

136145
## License
137146

assets/bold/activity-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/address-book-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplane-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplane-in-flight-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplane-landing-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplane-takeoff-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplane-tilt-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/bold/airplay-bold.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)