返回列表 发布新帖

html字体图标生成和下载

2316 0
邓小K 发表于 3 天前 | 查看全部 阅读模式 <

马上注册,结交更多好友,享用更多功能,让你轻松玩转小K网。

您需要 登录 才可以下载或查看,没有账号?立即注册 微信登录

×
html字体图标生成和下载(方便、快捷、实用)
【写在前面:有时为了找个合适图标,花费较多时间,刚好有个网络字体库fontAwesome,通过反复研究转码成功,可用来做图标,改改颜色,保存ico即可】

html字体图标生成和下载

html字体图标生成和下载

html字体图标生成和下载

html字体图标生成和下载

功能介绍
图标:常用字体图标500个,每页100个,因当前字体免费版本限制,个别可能显示为网络。
搜索:支持中文搜索,为全部范围搜索。
尺寸:16×16、32×32、48×48、64×64、128×128、256×256
颜色:调色板选择颜色
预览:根据尺寸和颜色预览,备注:当前颜色、当前尺寸、当前颜色(如#e70d39)
保存:支持png、svg、ico格式,ico自动为透明背景色。
关键代码
  1.         // 下载PNG
  2.         async function downloadPNG() {
  3.             const loadingIndicator = document.getElementById('loadingIndicator');
  4.             loadingIndicator.style.display = 'block';
  5.             try {
  6.                 const canvas = await createIconCanvas(selectedSize);
  7.                 // 创建下载链接
  8.                 const link = document.createElement('a');
  9.                 const iconName = selectedIcon.replace('fa-', '');
  10.                 const chineseName = iconChineseNames[selectedIcon] || iconName;
  11.                 link.download = `fontawesome-${chineseName}-${selectedSize}px.png`;
  12.                 link.href = canvas.toDataURL('image/png');
  13.                 link.click();
  14.                 loadingIndicator.style.display = 'none';
  15.             } catch (error) {
  16.                 console.error('生成PNG文件时出错:', error);
  17.                 loadingIndicator.style.display = 'none';
  18.                 alert('生成PNG文件时出错,请重试');
  19.             }
  20.         }
  21.        ...
  22.         // 下载ICO
  23.         async function downloadICO() {
  24.             const loadingIndicator = document.getElementById('loadingIndicator');
  25.             loadingIndicator.style.display = 'block';
  26.             ...
复制代码
附件:
html软件(含字体库),解压到文件夹,双击浏览器打开即可使用。
下载地址:https://xiaok.lanzoum.com/iWG0T3f7fa9a

请大家文明发帖,遵守法律法规!站长QQ460551

回复

您需要登录后才可以回帖 登录 | 立即注册 微信登录

本版积分规则

您需要 登录 后才可以回复,轻松玩转社区,没有帐号?立即注册
快速回复
关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表