@ghs- 危险图/资产
所有全球统一制度化学品危险象形图(GHS01-GHS09)和联合国运输危险类象形图的静态图像资产。 每个象形图都作为优化的SVG+光栅出口提供,在PNG,JPEG,和WebP中为5个尺寸.
这个包是一组没有JavaScript运行时间的静态文件. 它的消耗 @ghs-hazard-pictograms/css 并可以直接用于任何需要原始图像文件的工程.
安装
npm install @ghs-hazard-pictograms/assets
# or
yarn add @ghs-hazard-pictograms/assets
# or
pnpm add @ghs-hazard-pictograms/assets
文件格式和大小
| 格式 | 大小 (px2) |
|---|---|
| 特别工作组 | —— (媒介,分辨率独立) |
| 巴布亚新几内亚 | 240、512、768、1024、2048 |
| JPEG 组合 | 240、512、768、1024、2048 |
| 网络P | 240、512、768、1024、2048 |
目录结构
assets/
physical_hazards_pictograms/
ghs01_explosive/
GHS-pictogram-explos.svg
GHS-pictogram-explos-240.png
GHS-pictogram-explos-512.png
...
ghs02_flammable/
ghs03_oxidizing/
ghs04_compressed_gas/
ghs05_corrosive/
health_hazards_pictograms/
ghs06_toxic/
ghs07_health_hazard/
ghs08_serious_health_hazard/
environmental_hazards_pictograms/
ghs09_hazardous_to_environment/
transport_pictograms/
ADR_1.svg (Divisions 1.1–1.3)
ADR_1.4.svg
ADR_1.5.svg
ADR_1.6.svg
ADR_2.1.svg
ADR_2.2.svg
ADR_2.3.svg
ADR_3.svg
ADR_5.1.svg
ADR_5.2.svg
ADR_6.1.svg
ADR_8.svg
UN_transport_pictogram_-_6.2.svg
UN_transport_pictogram_-_7.svg
UN_transport_pictogram_-_8.svg
UN_transport_pictogram_-_9.svg
...
使用量
在捆绑(webpack,Vite等)中
import explosiveSvg from '@ghs-hazard-pictograms/assets/assets/physical_hazards_pictograms/ghs01_explosive/GHS-pictogram-explos.svg';
const img = document.createElement('img');
img.src = explosiveSvg;
在 HTML 中
<img
src="node_modules/@ghs-hazard-pictograms/assets/assets/physical_hazards_pictograms/ghs01_explosive/GHS-pictogram-explos.svg"
width="64"
height="64"
alt="GHS01 Explosive"
/>
带CDN
如果你的捆绑机复制 node_modules 资产输入公共目录,通过解析路径参考。 比如说Vite的 public/ 复制或CDN 主机为您 node_modules数字 :
<img
src="/assets/ghs-hazard-pictograms/assets/physical_hazards_pictograms/ghs01_explosive/GHS-pictogram-explos-512.png"
/>
通过搜索资产路径 @ghs-hazard-pictograms/core
如果您需要按方案解决资产路径:
import { getPictogram } from '@ghs-hazard-pictograms/core';
const p = getPictogram('ghs01-explosive')!;
console.log(p.assets.svg); // relative SVG path
console.log(p.assets.png[512]); // relative path to 512px PNG
console.log(p.assets.webp[1024]); // relative path to 1024px WebP
相关软件包
| 软件包 | 说明 |
|---|---|
@ghs-hazard-pictograms/core | 原始数据、内置的 SVGs 和搜索助手(框架-不可知) |
@ghs-hazard-pictograms/react | React 组件( 内置 SVG, 不需要外部文件) |
@ghs-hazard-pictograms/css | 引用这些资产文件的 CSS 图示工作表 |
@ghs-hazard-pictograms/sprite | 特别工作组 <symbol> 图标用于 <use href> 嵌入 |