|
3 | 3 | - [figma paint - gradient paint](https://www.figma.com/plugin-docs/api/Paint/#gradientpaint)
|
4 | 4 | - [css gradient](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient)
|
5 | 5 |
|
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** |
7 | 25 |
|
8 | 26 | - linear gradient
|
9 | 27 | - radial gradient
|
@@ -50,3 +68,23 @@ background: radial-gradient(red, blue);
|
50 | 68 |
|
51 | 69 | > **gradient paint degree**
|
52 | 70 | > 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