Skip to content

Commit 8adc0fc

Browse files
update doc - close #79
1 parent a66c8e6 commit 8adc0fc

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

docs/figma-gradient.md

+39-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,25 @@
33
- [figma paint - gradient paint](https://www.figma.com/plugin-docs/api/Paint/#gradientpaint)
44
- [css gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient)
55

6-
## gradient type
6+
## Cases
7+
8+
- Gradient fills in Ellipse, Rect, Frame > Standard styles
9+
- Gradient fills in vector path > SVG / PNG
10+
- Complex gradient > SVG / PNG
11+
12+
## Understanding Figma Gradient system - It's not like what you think!
13+
14+
Gradient in figma is bit different on render-styling (css) If you have LinearGradient - `[(black 1) at 0%, (red 0) at 100%]` Representation in css would be `linear-gradient(90deg, rgba(0,0,0,1) 0%, rgba(255,0,0,0) 100%);`, you might think. But this is incorrect.
15+
16+
To match a visually identical gradient, you need to have multiple gradient per colors. (Even if it is in a single fill item)
17+
18+
```css
19+
.single-fill-item {
20+
background: linear-gradient(90deg, black, transparent), linear-gradient(90deg, rgba(255, 0, 0, 1), transparent);
21+
}
22+
```
23+
24+
**types of gradient**
725

826
- linear gradient
927
- radial gradient
@@ -50,3 +68,23 @@ background: radial-gradient(red, blue);
5068
5169
> **gradient paint degree**
5270
> WIP
71+
72+
## Note - Fallbacks on complex gradient
73+
74+
> This is a technical issue, we will add support for complex gradient in the future. [Learn More](https://github.com/gridaco/designto-code/issues/78)
75+
76+
Since perfectly providing a visually identical style code is redundant, we provide a fallback on complex gradient. (svg on web, png(optionally) on flutter)
77+
78+
**Fallback cases**
79+
80+
- when gradient position does not starts from (or ends at) 0% or 100%
81+
- when gradient is not linear or radial.
82+
- when not one of the cases
83+
- n - s (0°) (supported)
84+
- s - n (180°) (supported)
85+
- e - w (270°) (supported)
86+
- w - e (90°) (supported)
87+
- nw - se (directional) (supported)
88+
- ne - sw (directional) (supported)
89+
- sw - ne (directional) (supported)
90+
- se - nw (directional) (supported)

0 commit comments

Comments
 (0)