Files

79 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2020-10-25 22:48:03 +01:00
# Icon Design Guide
Here are rules that should be followed to keep quality and consistency when making icons for Lucide.
## Summary of the rules we have
2020-10-27 21:48:45 +01:00
1. Icons must be designed on a **24 by 24 pixels** canvas.
2. Icons must have a **1 pixel padding** within the canvas.
3. Icons must have a **stroke width of 2 pixels**.
4. Icons must use **round joins**.
5. Icons must use **round caps**.
6. Icons must use **centered strokes**.
7. Shapes (such as rectangles) in icons must have **border radius of 2 pixels**.
8. Distinct elements must have **2 pixels of spacing between each other**.
2020-10-25 22:48:03 +01:00
## The Rules Visualized
2020-10-27 21:48:45 +01:00
### 1. Icons must be designed on a 24 by 24 pixels canvas.
2020-10-25 22:48:03 +01:00
![24px-24px](images/24px-24px.png?raw=true "24px-24px")
2020-10-27 21:48:45 +01:00
### 2. Icons must have a 1 pixel padding within the canvas.
2020-10-25 22:48:03 +01:00
![1px-padding](images/1px-padding.png?raw=true "1px-padding")
2020-10-27 21:48:45 +01:00
### 3. Icons must have a stroke width of 2 pixels.
2020-10-25 22:48:03 +01:00
![2px-stroke](images/2px-stroke.png?raw=true "2px-stroke")
2020-10-27 21:48:45 +01:00
### 4. Icons must use round joins.
2020-10-25 22:48:03 +01:00
![round-joints](images/round-joints.png?raw=true "round-joints")
2020-10-27 21:48:45 +01:00
### 5. Icons must use round caps.
2020-10-25 22:48:03 +01:00
![round-caps](images/round-caps.png?raw=true "round-caps")
2020-10-27 21:48:45 +01:00
### 6. Icons must use centered strokes.
2020-10-25 22:48:03 +01:00
![centered-strokes](images/centered-strokes.png?raw=true "centered-strokes")
2020-10-27 21:48:45 +01:00
### 7. Shapes (such as squares) in icons must have border radius of 2 pixels.
2020-10-25 22:48:03 +01:00
![2px-border-radius](images/2px-border-radius.png?raw=true "2px-border-radius")
2020-10-27 21:48:45 +01:00
### 8. Distinct elements must have 2 pixels of spacing between each other.
2020-10-25 22:48:03 +01:00
![2px-element-spacing](images/2px-element-spacing.png?raw=true "2px-element-spacing")
## Code Conventions
Before an icon is added to the library, we like to have readable and optimized svg code.
### Global Attributes
2020-10-27 21:48:45 +01:00
For each icon these attributes are applied, corresponding to the above rules.
2020-10-25 22:48:03 +01:00
```xml
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<!-- SVGElements -->
</svg>
```
### Minify paths
Code of paths can get really big.
To reduce file size we like to minify the code.
We recommend to use the [SVGOMG](https://jakearchibald.github.io/svgomg/) to minify paths.