You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/syntax/flowchart.md
-15
Original file line number
Diff line number
Diff line change
@@ -1816,7 +1816,6 @@ or
1816
1816
##### Linear gradient examples
1817
1817
1818
1818
**1. Basic gradient**
1819
-
1820
1819
Create a basic gradient from red to blue, flowing from top to bottom (default direction):
1821
1820
1822
1821
```mermaid-example
@@ -1848,7 +1847,6 @@ flowchart
1848
1847
In this example, the gradient starts with red at the top and transitions to blue at the bottom.
1849
1848
1850
1849
**2. Gradient with directional keywords**
1851
-
1852
1850
Use directional keywords to define the gradient's direction:
1853
1851
1854
1852
```mermaid-example
@@ -1866,7 +1864,6 @@ flowchart LR
1866
1864
This gradient moves from the top-right corner to the bottom-left corner, starting with pink and ending with cyan.
1867
1865
1868
1866
**3. Gradient with angle**
1869
-
1870
1867
Specify the gradient angle to control the direction:
1871
1868
1872
1869
```mermaid-example
@@ -1884,7 +1881,6 @@ flowchart BT
1884
1881
The gradient line is tilted at a 35-degree angle, starting with orange and transitioning to purple.
1885
1882
1886
1883
**4. Multiple color stops**
1887
-
1888
1884
Include multiple color stops at specific positions:
1889
1885
1890
1886
```mermaid-example
@@ -1902,7 +1898,6 @@ flowchart LR
1902
1898
Here, the gradient starts with red at the top, transitions to yellow at 30%, green at 60%, brown at 90%, and ends with Deep Sky Blue at the bottom.
1903
1899
1904
1900
**5. Length Units for color stops**
1905
-
1906
1901
Use length units for color stop positions (physical units like `cm` are calculated assuming _96dpi_):
1907
1902
1908
1903
```mermaid-example
@@ -1920,7 +1915,6 @@ flowchart LR
1920
1915
This gradient moves from left to right, using specific lengths and percentages to control where colors change.
1921
1916
1922
1917
**6. Gradients with opacity**
1923
-
1924
1918
Apply gradients using colors with opacity:
1925
1919
1926
1920
```mermaid-example
@@ -1938,7 +1932,6 @@ flowchart TD
1938
1932
The gradient transitions from semi-transparent red to semi-transparent blue diagonally.
1939
1933
1940
1934
**7. Automatic positioning**
1941
-
1942
1935
If positions for color stops are not specified, they are distributed evenly:
1943
1936
1944
1937
```mermaid-example
@@ -1956,7 +1949,6 @@ flowchart LR
1956
1949
In this example, the gradient begins with red from 0% to 10% (specified), transitions smoothly to green at 30%, then to orange at 50%, blue at 70%, and finally reaches cyan at 90% (specified), remaining cyan until the end, distributing the colors with missing positions evenly throughout.
1957
1950
1958
1951
**8. Overlapping positions**
1959
-
1960
1952
If color stops have overlapping positions, Mermaid adjusts them to maintain the correct order:
1961
1953
1962
1954
```mermaid-example
@@ -1974,7 +1966,6 @@ flowchart RL
1974
1966
Here, since 40% comes after 60%, the white color stop at 40% is adjusted to 60% to keep positions ascending.
1975
1967
1976
1968
**9. Out-of-bounds positions**
1977
-
1978
1969
Color stops set outside the 0% to 100% range cause the gradient to stretch beyond the edges.
1979
1970
1980
1971
```mermaid-example
@@ -1992,7 +1983,6 @@ flowchart TD
1992
1983
In this gradient, red at -20% blends toward yellow and appears as a red-yellow mix at 0%. Likewise, green at 145% blends with yellow near 100%, creating a yellow-green mix rather than pure green at the end. Yellow is centered because the 50% stop is explicitly defined.
1993
1984
1994
1985
**10. Sharp color transition**
1995
-
1996
1986
Specifying two identical positions for consecutive colors creates a sharp transition:
1997
1987
1998
1988
```mermaid-example
@@ -2010,7 +2000,6 @@ flowchart LR
2010
2000
This results in a sharp change from red to blue exactly at the 50% mark.
2011
2001
2012
2002
**11. Double color stops**
2013
-
2014
2003
Using double positions for a color creates a solid zone with that colors:
2015
2004
2016
2005
```mermaid-example
@@ -2042,7 +2031,6 @@ flowchart TD
2042
2031
In this example, the gradient transitions from yellow to red between 0% and 30%, remains solid red between 30% and 50%, and then transitions from red to blue after 50%.
2043
2032
2044
2033
**12. Color functions**
2045
-
2046
2034
Mermaid supports CSS color functions, provided they are supported by the browser:
2047
2035
2048
2036
```mermaid-example
@@ -2058,7 +2046,6 @@ flowchart LR
2058
2046
```
2059
2047
2060
2048
**13. Applying gradients to different shapes**
2061
-
2062
2049
Gradients adjust based on the node's shape and dimensions:
2063
2050
2064
2051
```mermaid-example
@@ -2087,7 +2074,6 @@ flowchart TD
2087
2074
Non-linear color transitions occur when using transition hints or colors with varying opacity. See the two scenarios below.
2088
2075
2089
2076
**Scenario I: interpolating between colors with color transition hint**
2090
-
2091
2077
Transition hints are positional markers that can be placed between color stops to guide the gradient's interpolation.
2092
2078
2093
2079
```mermaid-example
@@ -2124,7 +2110,6 @@ In this gradient, the transition is from a semi-transparent red (90% opacity) to
2124
2110
> You are allowed to have both transition hints and opacity variations in the same gradient.
2125
2111
2126
2112
**Fine-tuning non-linear interpolation with custom transition stops**
2127
-
2128
2113
You can specify `num-transition-stops` directly in the `style` or `classDef` to customize the number of segments that make up the gradient transition. The default is `5`, which provides a decent transition, but adjusting this number allows for finer control. This value must be odd to align with the symmetry logic used for interpolation. Here is an example:
Copy file name to clipboardExpand all lines: packages/mermaid/src/docs/syntax/flowchart.md
-15
Original file line number
Diff line number
Diff line change
@@ -1164,7 +1164,6 @@ A comprehensive collection of side-by-side examples comparing Mermaid and CSS li
1164
1164
##### Linear gradient examples
1165
1165
1166
1166
**1. Basic gradient**
1167
-
1168
1167
Create a basic gradient from red to blue, flowing from top to bottom (default direction):
1169
1168
1170
1169
```mermaid-example
@@ -1184,7 +1183,6 @@ flowchart
1184
1183
In this example, the gradient starts with red at the top and transitions to blue at the bottom.
1185
1184
1186
1185
**2. Gradient with directional keywords**
1187
-
1188
1186
Use directional keywords to define the gradient's direction:
1189
1187
1190
1188
```mermaid-example
@@ -1196,7 +1194,6 @@ flowchart LR
1196
1194
This gradient moves from the top-right corner to the bottom-left corner, starting with pink and ending with cyan.
1197
1195
1198
1196
**3. Gradient with angle**
1199
-
1200
1197
Specify the gradient angle to control the direction:
1201
1198
1202
1199
```mermaid-example
@@ -1208,7 +1205,6 @@ flowchart BT
1208
1205
The gradient line is tilted at a 35-degree angle, starting with orange and transitioning to purple.
1209
1206
1210
1207
**4. Multiple color stops**
1211
-
1212
1208
Include multiple color stops at specific positions:
1213
1209
1214
1210
```mermaid-example
@@ -1220,7 +1216,6 @@ flowchart LR
1220
1216
Here, the gradient starts with red at the top, transitions to yellow at 30%, green at 60%, brown at 90%, and ends with Deep Sky Blue at the bottom.
1221
1217
1222
1218
**5. Length Units for color stops**
1223
-
1224
1219
Use length units for color stop positions (physical units like `cm` are calculated assuming _96dpi_):
1225
1220
1226
1221
```mermaid-example
@@ -1232,7 +1227,6 @@ flowchart LR
1232
1227
This gradient moves from left to right, using specific lengths and percentages to control where colors change.
1233
1228
1234
1229
**6. Gradients with opacity**
1235
-
1236
1230
Apply gradients using colors with opacity:
1237
1231
1238
1232
```mermaid-example
@@ -1244,7 +1238,6 @@ flowchart TD
1244
1238
The gradient transitions from semi-transparent red to semi-transparent blue diagonally.
1245
1239
1246
1240
**7. Automatic positioning**
1247
-
1248
1241
If positions for color stops are not specified, they are distributed evenly:
1249
1242
1250
1243
```mermaid-example
@@ -1256,7 +1249,6 @@ flowchart LR
1256
1249
In this example, the gradient begins with red from 0% to 10% (specified), transitions smoothly to green at 30%, then to orange at 50%, blue at 70%, and finally reaches cyan at 90% (specified), remaining cyan until the end, distributing the colors with missing positions evenly throughout.
1257
1250
1258
1251
**8. Overlapping positions**
1259
-
1260
1252
If color stops have overlapping positions, Mermaid adjusts them to maintain the correct order:
1261
1253
1262
1254
```mermaid-example
@@ -1268,7 +1260,6 @@ flowchart RL
1268
1260
Here, since 40% comes after 60%, the white color stop at 40% is adjusted to 60% to keep positions ascending.
1269
1261
1270
1262
**9. Out-of-bounds positions**
1271
-
1272
1263
Color stops set outside the 0% to 100% range cause the gradient to stretch beyond the edges.
1273
1264
1274
1265
```mermaid-example
@@ -1280,7 +1271,6 @@ flowchart TD
1280
1271
In this gradient, red at -20% blends toward yellow and appears as a red-yellow mix at 0%. Likewise, green at 145% blends with yellow near 100%, creating a yellow-green mix rather than pure green at the end. Yellow is centered because the 50% stop is explicitly defined.
1281
1272
1282
1273
**10. Sharp color transition**
1283
-
1284
1274
Specifying two identical positions for consecutive colors creates a sharp transition:
1285
1275
1286
1276
```mermaid-example
@@ -1292,7 +1282,6 @@ flowchart LR
1292
1282
This results in a sharp change from red to blue exactly at the 50% mark.
1293
1283
1294
1284
**11. Double color stops**
1295
-
1296
1285
Using double positions for a color creates a solid zone with that colors:
1297
1286
1298
1287
```mermaid-example
@@ -1312,7 +1301,6 @@ flowchart TD
1312
1301
In this example, the gradient transitions from yellow to red between 0% and 30%, remains solid red between 30% and 50%, and then transitions from red to blue after 50%.
1313
1302
1314
1303
**12. Color functions**
1315
-
1316
1304
Mermaid supports CSS color functions, provided they are supported by the browser:
1317
1305
1318
1306
```mermaid-example
@@ -1322,7 +1310,6 @@ flowchart LR
1322
1310
```
1323
1311
1324
1312
**13. Applying gradients to different shapes**
1325
-
1326
1313
Gradients adjust based on the node's shape and dimensions:
1327
1314
1328
1315
```mermaid-example
@@ -1343,7 +1330,6 @@ The gradient line length is determined by projecting a shape's dimensions along
1343
1330
Non-linear color transitions occur when using transition hints or colors with varying opacity. See the two scenarios below.
1344
1331
1345
1332
**Scenario I: interpolating between colors with color transition hint**
1346
-
1347
1333
Transition hints are positional markers that can be placed between color stops to guide the gradient's interpolation.
1348
1334
1349
1335
```mermaid-example
@@ -1369,7 +1355,6 @@ You are allowed to have both transition hints and opacity variations in the same
1369
1355
```
1370
1356
1371
1357
**Fine-tuning non-linear interpolation with custom transition stops**
1372
-
1373
1358
You can specify `num-transition-stops` directly in the `style` or `classDef` to customize the number of segments that make up the gradient transition. The default is `5`, which provides a decent transition, but adjusting this number allows for finer control. This value must be odd to align with the symmetry logic used for interpolation. Here is an example:
0 commit comments