Giter Site home page Giter Site logo

bytedance / iconpark Goto Github PK

View Code? Open in Web Editor NEW
8.0K 52.0 471.0 12.61 MB

🍎Transform an SVG icon into multiple themes, and generate React icons,Vue icons,svg icons

Home Page: http://iconpark.bytedance.com/

License: Apache License 2.0

TypeScript 99.99% Less 0.01%
svg stroke icons icon-components multiple-themes svg-icon fill vue-component icon vue-next

iconpark's Introduction

English | 简体中文

Introduction

IconPark gives access to more than 2000 high-quality icons, and introduces an interface for customizing your icons. Instead of using various SVG source files to achieve different themes, we implement a technology transforming attributes of a single SVG source file into multiple themes. Besides, we provide cross-platform components, including react-icons, vue-icons and svg-icons. So whether you are a designer or a developer, you can use them in your designs or your projects for free.

Packages

Generate Cross-platform Components

Find packages in packages folder. NPM packages make it painless to import icon components to your project.

Name Github link NPM link
React Icons React Component @icon-park/react
Vue2 Icons Vue Component for old Vue2.0 @icon-park/vue
Vue3 Icons Vue Component for Vue3.0 @icon-park/vue-next
SVG Icons Pure SVG String @icon-park/svg

Multiple themes

Basic coloring can be done by setting two attributes on the node: fill and stroke. Fill sets the color inside the object while stroke sets the color of the line drawn around the object. By changing this two attributes, you can transform a single SVG icon into different themes, including: outline, filled, two-tone, multi-color. Take the icon named camera for example:

Source file:

After Transforming:

React icons Preview Theme
<Camera theme="outline" size="32" fill="#000000"/> Outline theme
<Camera theme="filled" size="32" fill="#333"/> Filled theme
<Camera theme="two-tone" size="32" fill={['#333' ,'#2F88FF']}/> Two-tone theme
<Camera theme="multi-color" size="32" fill={['#333' ,'#2F88FF' ,'#FFF' ,'#43CCF8']}/> Multi-color theme

Embed IconPark in your project

If you need to use additional information such as icon name, author, category, label and creation time, you can use the icons.json file located in the root directory of each NPM.

Website

Customization

Here is the website of IconPark. Each icon is hand-coded within a 48x48 grid, using SVG stroke giving the maximum flexibility on styling. You can adjust the color, size, stroke-width, stroke-linejoin, stroke-linecap and other attributes to meet your needs.

Screenshot of customization

Convenient Online Tools

You can use them in Figma, Sketch, Photoshop, PPT, etc.

  • Copy SVG
  • Copy React Icon Component
  • Copy Vue Icon Component
  • Download PNG
  • Download SVG

Icon Tools

Changelog

CHANGELOG.en-US | CHANGELOG.简体中文

iconpark's People

Contributors

antfu avatar applemonkey2019 avatar carlosyan1807 avatar iamyoki avatar iconpark-tech avatar liuxuanzy avatar lovedstyle avatar meowtec avatar pd4d10 avatar rubickecho avatar thoamsy avatar wsz7777 avatar zhaoxinlong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iconpark's Issues

Website: lighter and faster color picker component

Hi! Nice icons and website!

I noticed that you're using react-color on your website.
Just want to suggest you consider using a lighter and faster option since react-color is 140 KB (far larger than the entirety of react-dom), is not tree-shakeable, is not accessible, does not support keyboard navigation, pulls in 11 dependencies, and is not as fast as it could be. See https://bundlephobia.com/[email protected]

Several months ago I created react-colorful as a modern replacement for react-color. My library is 18 times lighter (less than 2 KB gzip) and way faster:

Let me know if you're interested in using my component or if you need any help with migration.

Regards,
Vlad

[RFC] 新增直接复制 JSX 代码片段功能

应用背景

很多场景中,对 React 开发者来说,并不需要引入整个 @icon-park/react 库。他们只想在 IconPark 中在线选择想要的图标,即贴即用就行,但是目前 IconPark 平台仅支持 svg,希望能加入复制 jsx/tsx 功能。

image

写法差异

svg

<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
  <rect width="48" height="48" fill="white" fill-opacity="0.01"/>
  <path d="M9 18V42H39V18L24 6L9 18Z" fill="#2F88FF"/>
  <path d="M9 42V18L4 22L24 6L44 22L39 18V42H9Z" stroke="black" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
  <path d="M19 29V42H29V29H19Z" fill="#43CCF8" stroke="white" stroke-width="4" stroke-linejoin="round"/>
  <path d="M9 42H39" stroke="black" stroke-width="4" stroke-linecap="round"/>
</svg>

jsx

<svg
  xmlns="http://www.w3.org/2000/svg"
  width="48"
  height="48"
  fill="none"
  viewBox="0 0 48 48"
>
  <path fill="#fff" fillOpacity="0.01" d="M0 0H48V48H0z"></path>
  <path fill="#2F88FF" d="M9 18v24h30V18L24 6 9 18z"></path>
  <path
    stroke="#000"
    strokeLinecap="round"
    strokeLinejoin="round"
    strokeWidth="4"
    d="M9 42V18l-5 4L24 6l20 16-5-4v24H9z"
  ></path>
  <path
    fill="#43CCF8"
    stroke="#fff"
    strokeLinejoin="round"
    strokeWidth="4"
    d="M19 29v13h10V29H19z"
  ></path>
  <path
    stroke="#000"
    strokeLinecap="round"
    strokeWidth="4"
    d="M9 42h30"
  ></path>
</svg>

实现方式

使用这个库 svg2jsx 将 svg 转化成 jsx 即可。

import transform from '@svg2jsx/transform';
- onClipboard(svg)
+ onClipboard(transform(svg, {}))

Pull Requst

如果可以,我想加入 IconPart 大家庭,提 PR,成为 contributor 之一,谢谢 @AppleMonkey2019

[Vue warn]: Injection "ICON_CONFIGS"

vue 版本 2.6.12

删除node_moudules和 yarn.lock 重新 yarn 无效

{
"name": "client",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"@icon-park/vue": "^1.0.11",
"axios": "^0.20.0",
"core-js": "^3.6.5",
"element-ui": "^2.13.2",
"vue": "^2.6.12",
"vue-router": "^3.2.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"vue-template-compiler": "^2.6.12"
}
}

如何正确地配置 babel-plugin-import ?

在我的babel.config.js中,我的配置如下:

plugins = [
  [
    'import',
    {
      libraryName: 'ant-design-vue',
      libraryDirectory: 'es',
      style: true,
    },
    'ant-design-vue',
  ],
  [
    'import',
    {
      libraryName: '@icon-park/vue',
      libraryDirectory: 'es/icons',
      camel2DashComponentName: false,
    },
    '@icon-park/vue',
  ],
]

这样配置的话,就会导致import { DEFAULT_ICON_CONFIGS } from '@icon-park/vue'报错:DEFAULT_ICON_CONFIGS is not defined
在我查看了库目录之后,发现DEFAULT_ICON_CONFIGS的导出文件不在es/icons下,我猜测是没有正确配置libraryDirectory的原因导致报错,所以应该如何正确配置呢?期待解答~

现在的搜索结果不太友好,希望能改进

比如我要搜索“问号”图标,直接搜索结果是空,但如果我换成“问”这个关键字进行搜索,就会在符号里搜索到名字叫“帮助”的图标。
我问下这个关键字的匹配能不能让用户自定义?
就如上面的例子,我第一次可能需要通过“问”关键字才能搜索到“帮助”图标;
但我可以在搜索到这个结果后为其设置成“问号”关键字,这样下次我搜索“问号”或者“问”一样也能出现“帮助”图标。
以上愚见可以参考下。谢谢~

关于下载使用默认名

现在下载下来的名称默认是英文,对于我这种英文不好的来说,常见的还可以翻译,大部分都不认识,下载的一多,就分不清谁是谁了,建议让下载下来的默认名称含有中文,或者说支持中英文切换,可以选择中文下载还是英文下载。

微信截图_20201023175710

能不能支持本地缓存已选中图标呀?

例如iconfont,可以github 登录,然后加到购物车去,下次可以进到购物车看自己挑好的图标

个人认为 iconPark 有时间的话可以考虑一手,初版先把用户勾选选中的也存到浏览器里(local storage 或 indexed db之类的都不错吧),下次打开页面选中的就默认被选中

后续如果风格调整,直接改右侧菜单的配置,左侧所有选中图标都能看到效果就挺不错的

不然截图存起来自己选中了哪些,下回再一个个搜出来,再整体调整样式,哇,想都不敢想

当然,这只是个建议

Size of `text-bold` icon

We are trying to use it in ByteMD

It seems the size of text-bold is slightly different from other icons if we put them together (16x16):

image

@icon-park/react and @byte-design/icons do not behave in accordance

Version

@byte-design/icons: 0.11.7
@icon-park/react: 1.0.9

What's the question?

  • The Loading icon can't always rotate
  • I added style to the Return icon but does not work

What is expected?

The Loading icon should always rotate and the Return icon added style can take effect. I don't know if the other ICONS have problems.

image

[bug] 全局导入的时候提示找不到包

import {IconPark} from '@icon-park/vue/all';
我使用该语句全局导入IconPark, npm提示找不到@icon-park/vue/all, 按需导入没有问题且可以正常使用, 全局导入报错信息如下

 ERROR  Failed to compile with 1 errors   17:00:13
This dependency was not found:

* @icon-park/vue/all in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/material/list.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save @icon-park/vue/all

能否来一套健身房系列的~

设备:杠铃、哑铃、器械、无器械
锻炼部位:胸部、肩膀、等等。

如果你们准备开始搞,我可以帮你们做一个分类整理

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.