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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
#let rtext(body)={
  text(fill:maroon,body)
}
= 可视化库(Visualize)<visualize>
绘图与数据可视化。

如果你想要创建更高级的图形或图表,也可以了解一下#link("https://github.com/cetz-package/cetz")[CeTZ包],以及适配你使用场景的#link("https://typst.app/universe")[更多专用包]。
=== 易用性(Accessibility)
Typst绘制的所有形状和路径都会自动标记为#link(<PDF_artifact>)[装饰元素],这样在导出PDF时,辅助技术(AT)将不会识别它们。但它们内部的内容(如果存在)仍然可以被访问。

如果你使用该类别中的函数创建带有语义含义的插图,请将其包裹在#link(<figure>)[figure]函数调用内以保证可访问性。使用它的#link(<figure_alt>)[alt参数]来提供#link(<Accessibility_Guide-Textual-representations>)[替代描述]。

== 圆(circle)<circle>
一个可附带可选内容的圆形。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
// Without content.
#circle(radius: 25pt)

// With content.
#circle[
  #set align(center + horizon)
  Automatically \
  sized to fit.
]
```
  ],[
      // Without content.
      #circle(radius: 25pt)

      // With content.
      #circle[
        #set align(center + horizon)
        Automatically \
        sized to fit.
      ]
  ]
)
=== 参数(Parameters)
```typc
circle(
    radius: length,
    width: auto relative,
    height: auto relative fraction,
    fill: none color gradient tiling,
    stroke: none auto length color gradient stroke tiling dictionary,
    inset: relative dictionary,
    outset: relative dictionary,
    body: none content,
) → content
```
- *radius*: length<circle_radius>
该圆形的半径。该参数与宽度、高度互斥。默认值:```typc 0pt```。
- *width*: auto relative<circle_width>
圆形的宽度。该参数与半径、高度互斥。默认值:```typc auto```。

与半径不同,该值可以相对于父容器的宽度进行设置。
- *height*: auto relative fraction<circle_height>
圆形的高度。该属性与半径、宽度互斥。默认值:```typc auto```。

与半径不同,该值可以相对于父容器的高度进行设置。
- *fill*: none color gradient tiling<circle_fill>
如何填充圆形。更多详情请参阅#link(<rect_fill>)[矩形的文档]。默认值:```typc none```。
- *stroke*: none auto length color gradient stroke tiling dictionary<circle_stroke>
如何绘制圆形轮廓。更多详情请参阅#link(<rect_stroke>)[矩形的文档]。默认值:```typc auto```。
- *inset*: relative dictionary<circle_inset>
圆形内容的内边距设置值。更多详情请参阅#link(<box>)[盒子]相关文档。默认值:```typc 0%+5pt```。
- *outset*: relative dictionary<circle_outset>
在不影响布局的前提下,需要将圆形的尺寸扩大多少。更多信息请查看#link(<box>)[盒子]相关文档。默认值:```typc (:)```。
- *body*: none content
放置在圆形内的内容。圆形会自动扩大以适配该内容,并保持1:1的宽高比。默认值:```typc none```。

#let rainbow(content) = {
  set text(fill: gradient.linear(..color.map.coolwarm))
  box(content)
}
== #rainbow[颜色(color)]<color>
特定色彩空间中的一种颜色。

Typst 支持:

-- 通过 #link(<color_rgb>)[rgb函数]使用 sRGB

-- 通过 #link(<color_cmyk>)[cmyk函数]使用设备 CMYK

-- 通过 #link(<color_luma>)[luma函数]使用 D65 灰度

-- 通过 #link(<color_oklab>)[oklab函数]使用 Oklab

-- 通过 #link(<color_oklch>)[oklch函数]使用 Oklch

-- 通过 #link(<color_linear-rgb>)[color.linear-rgb函数]使用线性 RGB

-- 通过 #link(<color_hsl>)[color.hsl函数]使用 HSL

-- 通过 #link(<color_hsv>)[color.hsv函数]使用 HSV

-- 通过 #link(<color_spot>)[color.spot类型]使用由专色着色剂描述的色彩空间

除CMYK和专色油墨外,所有色彩空间都带有Alpha通道。
在本文档中,我们将可以相互混合的色彩称为印刷原色(目前指除专色以外的所有色彩)。在该术语里,“印刷原色”表示色调是在整个印刷过程中生成,而非预先制作。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(86.27%)),
  [
    ```typst
#rect(fill: aqua)
```
  ],[
    #rect(fill: aqua)
  ]
)
=== 预定义的颜色(Predefined colors)<color_Predefined_colors>
Typst定义了以下内置颜色:
#table(

  columns: (1fr,1fr),
  align: left,
  stroke: none,
  table.header([*Color*],[*Definition*]),
  table.hline(),
  [black],[luma(0)],
  [gray],[luma(170)],
  [silver],[luma(221)],
  [white],[luma(255)],
  [navy],[rgb(\"\#001f3f\")],
  [blue],[rgb(\"\#0074d9\")],
  [aqua],[rgb(\"\#7fdbff\")],
  [teal],[rgb(\"\#39cccc\")],
  [eastern],[rgb(\"\#239dad\")],
  [purple],[rgb(\"\#b10dc9\")],
  [fuchsia],[rgb(\"\#f012be\")],
  [maroon],[rgb(\"\#85144b\")],
  [red],[rgb(\"\#ff4136\")],
  [orange],[rgb(\"\#ff851b\")],
  [yellow],[rgb(\"\#ffdc00\")],
  [olive],[rgb(\"\#3d9970\")],
  [green],[rgb(\"\#2ecc40\")],
  [lime],[rgb(\"\#01ff70\")],
)
预定义颜色以及最重要的颜色构造函数在全局范围内和颜色类型的作用域内均可使用,因此你既可以写color.red,也可以直接写red。
#grid(

  columns: 9,

  gutter: 8pt,

  inset: 20pt,

  fill: (x,y)=>
  if (x==0 and y==0) {black}
    else if (x==1 and y==0) { gray }
    else if(x==2 and y==0){silver}
    else if(x==3 and y==0){white}
    else if(x==4 and y==0){navy}
    else if(x==5 and y==0){blue}
    else if(x==6 and y==0){aqua}
    else if(x==7 and y==0){teal}
    else if(x==8 and y==0){eastern}
    else if(x==0 and y==1){purple}
    else if(x==1 and y==1){fuchsia}
    else if(x==2 and y==1){maroon}
    else if(x==3 and y==1){red}
    else if(x==4 and y==1){orange}
    else if(x==5 and y==1){yellow}
    else if(x==6 and y==1){olive}
    else if(x==7 and y==1){green}
    else if(x==8 and y==1){lime}
    ,
    align: center +horizon,
    [#text(fill: white,size: 10pt,"black")], [#text(fill: black,size: 10pt,"gray")], [#text(fill: black,size: 10pt,"silver")], [#text(fill: black,size: 10pt,"white")],
  [#text(fill: white,size: 10pt,"navy")], [#text(fill: white,size: 10pt,"blue")], [#text(fill: black,size: 10pt,"aqua")], [#text(fill: black,size: 10pt,"teal")],
  [#text(fill: black,size: 10pt,"eastern")], [#text(fill: white,size: 10pt,"purple")], [#text(fill: black,size: 10pt,"fhchsia")], [#text(fill: white,size: 10pt,"maroon")],
  [#text(fill: black,size: 10pt,"red")], [#text(fill: black,size: 10pt,"orange")], [#text(fill: black,size: 10pt,"yellow")], [#text(fill: black,size: 10pt,"olive")],
  [#text(fill: black,size: 10pt,"green")], [#text(fill: black,size: 10pt,"lime")],
)
=== 预定义颜色映射(Predefined color maps)<color_Predefined-color-maps>
Typst还内置了若干预设色板,可用于[渐变效果]。这些色板就是在color.map模块中定义的颜色数组。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#circle(fill: gradient.linear(..color.map.crest))
    ```
  ],
  [
    #circle(fill: gradient.linear(..color.map.crest))

  ]
)
#table(

  columns: (0.5fr,2fr),
  stroke: none,
  align: left,
  table.header([*Map*],[*Details*]),
  table.hline(),
  [turbo],[一张在感知上均匀的彩虹色地图。阅读#link("https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html")[这篇博客文章]了解更多详情。],
	[cividis],[一张从蓝色到灰色再到黄色的颜色图,更多详情请参阅#link("https://bids.github.io/colormap/")[这篇博客文章]。],
	[rainbow],[该颜色映射通过完整的色谱循环。最佳使用方式是将插值颜色空间设置为HSL。彩虹渐变不适合用于数据可视化,因为它在感知上并不均匀,因此值之间的差异对于读者来说会变得模糊不清。它只应作为装饰用途。],
	[spectral],[红黄蓝三色映射。],
	[viridis],[从紫色到青色再到黄色的颜色映射。],
	[inferno],[从黑到红再到黄的颜色映射。],
	[magma],[从黑色到紫色再到黄色的颜色映射。],
	[plasma],[从紫色到粉色再到黄色的颜色映射。],
	[rocket],[从黑到红再到白的颜色映射。],
	[mako],[从黑色到青色再到白色的颜色映射。],
	[coolwarm],[从蓝色到白色再到红色的颜色映射,颜色过渡平滑。],
	[vlag],[由浅蓝到白色再到红色的颜色映射。],
	[icefire],[从浅青色到黑色再到橙色的颜色映射。],
	[flare],[从橙色到紫色的颜色映射,在感知上是均匀的。],
	[crest],[从浅绿色到蓝色的颜色映射。],
)
部分热门预设并未纳入,原因是它们不提供免费许可。还有一些预设(例如Jet)未被加入,是因为它们对色盲群体不友好。你可以随意使用或创建包含其他对你有用预设的软件包!
#table(

  align: center,

  columns: 1,

  stroke: none,

  fill: luma(230),
  [
    #image("images/7004.png")
  ]
)
=== 定义(Definitions)

- *luma*<color_luma>
创建灰度颜色。

灰度颜色在内部由单一亮度分量表示。

也可以通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#for x in range(250, step: 50) {
  box(square(fill: luma(x)))
}
```
  ],[
      #for x in range(250, step: 50) {
        box(square(fill: luma(x)))
      }
  ]
)
```typc
color.luma(
    lightness: int ratio,
    alpha: ratio,
    color: color,
) → color
```
-- *lightness*: int or #rainbow[ratio]

明度分量。

-- *alpha*: ratio

透明度通道。

-- *color*: #rainbow[color]

或者:要转换为灰度的颜色。

如果指定了该参数,则不应设置亮度参数。
- *oklab*<color_oklab>
创建一个#link("https://bottosson.github.io/posts/oklab/")[Oklab]颜色。

该色彩空间非常适合以下场景:

-- 在保持感知色相不变的情况下进行饱和度调整等色彩处理

-- 生成具有均匀感知明度的灰度图像

-- 制作平滑且均匀的色彩过渡与渐变效果

线性Oklab颜色在内部由包含四个分量的数组表示:

-- 亮度(#link(<ratio>)[比率])

-- a(#link(<float>)[浮点数]或#link(<ratio>)[比率]。比率以0.4为基准;即50%等于0.2)

-- b(#link(<float>)[浮点数]或#link(<ratio>)[比率]。比率以0.4为基准;即50%等于0.2)

-- 透明度(alpha)(#link(<ratio>)[比率])

可通过components方法获取这些分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(

  fill: oklab(27%, 20%, -3%, 50%)
)
```
  ],[
    #square(

      fill: oklab(27%, 20%, -3%, 50%)
    )
  ]
)
```typc
color.oklab(
    lightness: ratio,
    a: float ratio,
    b: float ratio,
    alpha: ratio,
    color: color,
) → color
```
-- *lightness*: ratio

度量分量。

-- *a*: float ratio

a(“绿/红”)分量。

-- *b*: float ratio

b(蓝/黄)分量。

-- *alpha*: ratio

透明度通道。

-- *color*: #rainbow[color]

或者:要转换为Oklab的颜色。

如果指定此项,则不应提供各个分量。

- *oklch*<color_oklch>
创建一个#link("https://bottosson.github.io/posts/oklab/")[Oklch]颜色。

该色彩空间非常适合以下使用场景:

-- 涉及亮度、色度和色相的色彩处理

-- 生成具有均匀感知亮度的灰度图像

-- 制作平滑且均匀的色彩过渡与渐变

线性Oklch颜色在内部由包含四个分量的数组表示:

-- 亮度(比率)

-- 色度(浮点数或比率。比率相对于0.4;即50%等于0.2)

-- 色相(角度)

-- 透明度(比率)

可通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(

  fill: oklch(40%, 0.2, 160deg, 50%)
)
```
  ],[
      #square(

        fill: oklch(40%, 0.2, 160deg, 50%)
      )
  ]
)
```typc
color.oklch(
    lightness: ratio,
    chroma: float ratio,
    hue: angle,
    alpha: ratio,
    color: color,
) → color
```
-- *lightness*: ratio

亮度分量。

-- *chroma*: float ratio

色度分量。

-- *hue*: angle

色相分量。

-- *alpha*: ratio

 透明度(比率)

-- *color*: #rainbow[color]

或者:要转换为Oklch的颜色。

如果指定此项,则不应提供各个单独分量。
- *linear-rgb*<color_linear-rgb>
创建带有线性亮度的RGB(A)颜色。

该色彩空间与sRGB类似,区别在于颜色分量没有经过伽马校正。这便于执行混合、插值等色彩运算。不过,这类运算更推荐使用#link(<color_oklab>)[oklab函数]。

线性RGB(A)颜色在内部由包含四个分量的数组表示:

-- 红色(#link(<ratio>)[比率])

-- 绿色(#link(<ratio>)[比率])

-- 蓝色(#link(<ratio>)[比率])

-- 透明度(#link(<ratio>)[比率])

也可以通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(fill: color.linear-rgb(

  30%, 50%, 10%,

))
```
  ],[
    #set align(horizon)
    #square(fill: color.linear-rgb(

      30%, 50%, 10%,

    ))
  ]
)
```typc
color.linear-rgb(
    red: int ratio,
    green: int ratio,
    blue: int ratio,
    alpha: int ratio,
    color: color,
) → color
```
-- *red*: int ratio

红色分量。

-- *green*: int ratio

绿色分量。

-- *blue*: int ratio

蓝色分量。

-- *alpha*: int ratio

透明度通道。

-- *color*: #rainbow[color]

或者:要转换为线性RGB(A)的颜色。

如果指定了此项,则不应提供各个分量。

- *rgb*<color_rgb>
创建一个RGB(A)颜色。

该颜色在sRGB色彩空间中指定。

RGB(A)颜色在内部由包含四个分量的数组表示:

-- 红色(比例值)

-- 绿色(比例值)

-- 蓝色(比例值)
-- 透明度(比例值)

可通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(fill: rgb("#b1f2eb"))
#square(fill: rgb(87, 127, 230))
#square(fill: rgb(25%, 13%, 65%))
```
  ],[
    #set align(horizon)
    #square(fill: rgb("#b1f2eb"))
    #square(fill: rgb(87, 127, 230))
    #square(fill: rgb(25%, 13%, 65%))
  ]
)
```typc
color.rgb(
    red: int ratio,
    green: int ratio,
    blue: int ratio,
    alpha: int ratio,
    hex: str,
    color: color,
) → color
```
-- *red*: int ratio

红色分量。

-- *green*: int ratio

绿色分量。

-- *blue*: int ratio

蓝色分量。

-- *alpha*: int ratio

透明度通道。

-- *hex*: str

或者:十六进制表示的颜色。

支持3位、4位、6位或8位十六进制数字,可选择带上前置井号。

如果指定该值,则不应再单独设置各颜色分量。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#text(16pt, rgb("#239dad"))[
  *Typst*
]
```
  ],[
    #text(16pt, rgb("#239dad"))[
      *Typst*
    ]
  ]
)
-- *color*: #rainbow[color]

或者:要转换为线性RGB(A)的颜色。

如果指定了此项,则不应提供各个分量。
- *cmyk*<color_cmyk>
创建CMYK颜色。

如果你需要适配特定打印机,这个功能会很有用。转换成用于屏幕预览的RGB颜色,其效果可能和打印机实际输出的颜色存在差异。

CMYK颜色在内部由包含四个分量的数组表示:

-- 青色(cyan )(比例值)

-- 品红色(magenta)(比例值)

-- 黄色(yellow)(比例值)

-- 黑色(key)(比例值)

也可以通过#link(<color_components>)[components]方法获取这些分量。

请注意,启用PDF/A输出时,目前暂不支持CMYK颜色。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(

  fill: cmyk(27%, 0%, 3%, 5%)
)
```
  ],[
    #set align(horizon)
    #square(

      fill: cmyk(27%, 0%, 3%, 5%)
    )
      ]
)
```typc
color.cmyk(
    cyan: ratio,
    magenta: ratio,
    yellow: ratio,
    key: ratio,
    color: color,
) → color
```
-- *cyan*: ratio

青色分量。

-- *magenta*: ratio

品红色分量。

-- *yellow*: ratio

黄色分量。

-- *key*: ratio

黑色分量。

-- *color*: #rainbow[color]

或者:要转换为CMYK模式的颜色。

如果指定此项,则不应提供各个分量值。
- *hsl*<color_hsl>
创建一个HSL颜色。

该色彩空间适合通过色相、饱和度和明度来指定颜色,也适用于色彩处理,例如在保持人眼感知色相不变的同时调整饱和度。

HSL颜色在内部由包含四个分量的数组表示:

-- 色相(角度)

-- 饱和度(比率)

-- 亮度(比率)

-- 透明度(比率)

可通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(

  fill: color.hsl(30deg, 50%, 60%)
)
```
  ],[
    #set align(horizon)
    #square(

      fill: color.hsl(30deg, 50%, 60%)
    )
  ]
)
```typc
color.hsl(
    hue: angle,
    saturation: int ratio,
    lightness: int ratio,
    alpha: int ratio,
    color: color,
) → color
```
-- *hue*: angle

色相角。

-- *saturation*: int ratio

饱和度分量。

-- *lightness*: int ratio

亮度分量。

-- *alpha*: int ratio

透明度通道。

-- *color*: #rainbow[color]

或者:要转换为HSL的颜色。

如果指定此项,则不应单独提供各分量。
- *hsv*<color_hsv>
创建一个HSV颜色。

该色彩空间适用于通过色相、饱和度和明度来指定颜色。它也可用于色彩处理,例如在保持人眼感知色相不变的情况下调整饱和度。

HSV颜色在内部由包含四个分量的数组表示:

-- 色相(角度)

-- 饱和度(比率)

-- 亮度(比率)

-- 透明度(比率)

也可以通过#link(<color_components>)[components]方法获取这些分量。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#square(

  fill: color.hsv(30deg, 50%, 60%)
)
```
  ],[
    #set align(horizon)
    #square(

      fill: color.hsv(30deg, 50%, 60%)
    )
  ]
)
```typc
color.hsv(
    hue: angle,
    saturation: int ratio,
    value: int ratio,
    alpha: int ratio,
    color: color,
) → color
```
-- *hue*: angle

色相角。

-- *saturation*: int ratio

饱和度分量。

-- *value*: int ratio

亮度分量。

-- *alpha*: int ratio

透明度通道。

-- *color*: #rainbow[color]

或者:要转换为HSV的颜色。

如果指定此项,则不应单独提供各分量。

- *components*<color_components>
提取此颜色的各分量。

该数组的大小与数值取决于色彩空间。你可以通过#link(<color_space>)[space]获取色彩空间。下表列出了各类色彩空间及其对应的分量:
#table(

  columns: 5,

  align: left,

  stroke: none,

  table.header([*Color space*],[*C1*],[*C2*],[*C3*],[*C4*]),
  table.hline(),
  [#link(<color_luma>)[luma]],[Lightness],[],[],[],
  [#link(<color_oklab>)[oklab]],[Lightness],[a],[b],[Alpha],
  [#link(<color_oklch>)[oklch]],[Lightness],[Chroma],[Hue],[Alpha],
  [#link(<color_linear-rgb>)[linear-rgb]],[Red],[Green],[Blue],[Alpha],
  [#link(<color_rgb>)[rgb]],[Red],[Green],[Blue],[Alpha],
  [#link(<color_cmyk>)[cmyk]],[Cyan],[Magenta],[Yellow],[Key],
  [#link(<color_hsl>)[hsl]],[Hue],[Saturation],[Lightness],[Alpha],
  [#link(<color_hsv>)[hsv]],[Hue],[Saturation],[Value],[Alpha],
  [#link(<color_spot>)[spot]],[Tint],[],[],
)
各个独立值的含义与类型,请参阅对应色彩空间的文档。透明度(alpha)分量为可选项,仅当alpha参数为true时才会包含。返回数组的长度取决于分量数量以及是否包含透明度分量。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
// note that the alpha component is included by default
#rgb(40%, 60%, 80%).components()
    ```
  ],
  [
    #set align(center)
    // note that the alpha component is included by default
    #rgb(40%, 60%, 80%).components()
  ]
)
```typc
    self.components(alpha: bool) → array
```
-- *alpha*: bool

是否包含透明(Alpha)通道。
- *space*<color_space>
返回该颜色所属色彩空间的构造函数。

返回以下值之一:

-- #link(<color_luma>)[luma]

-- #link(<color_oklab>)[oklab]

-- #link(<color_oklch>)[oklch]

-- #link(<color_linear-rgb>)[linear-rgb]

-- #link(<color_rgb>)[rgb]

-- #link(<color_cmyk>)[cmyk]

-- #link(<color_hsl>)[hsl]

-- #link(<color_hsv>)[hsv]
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#let color = cmyk(1%, 2%, 3%, 4%)
#(color.space() == cmyk)
```
  ],[
    #set align(horizon)
    #let color = cmyk(1%, 2%, 3%, 4%)
    #(color.space() == cmyk)
  ]
)
```typc
    self.space() → spot any
```
- *to-hex*<color_to-hex>
返回该颜色的RGB(A)十六进制表示形式(例如 \#ffaa32 或 \#020304fe)。若透明度分量(\#020304fe中的最后两位)等于ff(255 / 100%),则省略该分量。
```typc
    self.to-hex() → str
```
- *lighten*<color_lighten>
将颜色按指定系数提亮。
```typc
    self.lighten(factor: ratio) → color
```
-- *factor*: ratio

用于提亮颜色的因子
- *darken*<color_darken>
按照给定系数降低颜色亮度。
```typc
    self.darken(factor: ratio) → color
```
-- *factor*: ratio

用于降色的因子
- *saturate*<color_saturate>
按指定系数提升颜色的饱和度。

仅印刷四色颜色可调整饱和度。如果需要调整专色的饱和度,请先将其转换为印刷四色颜色。
```typc
    self.saturate(factor: ratio) → color
```
-- *factor*: ratio

用于提升颜色饱和度的系数。
- *desaturate*<color_desaturate>
按指定系数降低颜色的饱和度。

仅印刷四色颜色可以降低饱和度。如果要降低专色的饱和度,请先将其转换为印刷四色颜色。
```typc
    self.desaturate(factor: ratio) → color
```
-- *factor*: ratio
```typc
    self.saturate(factor: ratio) → color
```
-- *factor*: ratio

用于降低颜色饱和度的系数。
- *negate*<color_negate>
使用提供的颜色空间生成互补色。你可以将其理解为色轮上的对立色。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#square(fill: yellow)
#square(fill: yellow.negate())
#square(fill: yellow.negate(space: rgb))
    ```
  ],
  [
    #square(fill: yellow)
    #square(fill: yellow.negate())
    #square(fill: yellow.negate(space: rgb))
  ]
)
```typc
    self.negate(space: auto spot any) → color
```

-- *space*: auto spot any

用于转换的颜色空间。默认情况下,使用感知颜色空间。
- *rotate*<color_rotate>
按指定角度旋转颜色的色相。

该函数仅适用于具有明确定义色相分量的颜色模型,即Oklch、HSL和HSV。
```typc
self.rotate(
    angle: angle,
    space: any,
) → color
```
-- *angle*: angle

色相旋转的角度。

-- *space*: any

用于旋转的色彩空间。默认情况下,该操作在感知色彩空间(oklch)中执行。
- *mix*<color_mix>
混合两种或多种颜色,生成新颜色。

在包含色相分量的色彩空间(HSL、HSV、Oklch)中,一次仅可混合两种颜色。在此类色彩空间中混合两种以上颜色将会报错!
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set block(height: 20pt, width: 100%)
#block(fill: red.mix(blue))
#block(fill: red.mix(blue, space: rgb))
#block(fill: color.mix(red, blue, white))
#block(fill: color.mix((red, 70%), (blue, 30%)))
    ```
  ],
  [
    #set block(height: 20pt, width: 100%)
    #block(fill: red.mix(blue))
    #block(fill: red.mix(blue, space: rgb))
    #block(fill: color.mix(red, blue, white))
    #block(fill: color.mix((red, 70%), (blue, 30%)))
  ]
)
```typc
color.mix(
    colors: ..color array,
    space: auto spot any,
) → color
```
-- *colors*: color array

颜色(可附带权重)以由颜色和权重(浮点数或比率)组成的二元组(长度为2的数组)形式指定。

权重之和不必为100%,权重是相对于所有权重总和的相对值。

-- *space*: auto spot any

用于混合的色彩空间。默认情况下,混合将在感知色彩空间(oklab)中进行;如果所有颜色都使用同一种专色油墨,则使用该油墨进行混合。

所有颜色都将转换为此色彩空间。
- *transparentize*<color_transparentize>
按给定系数使颜色变得更透明。

此方法与现有的alpha值相关。如果缩放值为正,则计算alpha - alpha \* 缩放值。负缩放值的行为类似于color.opacify(-缩放值)。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(220)}
    ,
  [
    ```typst
#block(fill: red)[opaque]
#block(fill: red.transparentize(50%))[half red]
#block(fill: red.transparentize(75%))[quarter red]
    ```
  ],
  [
    #block(fill: red)[opaque]
#block(fill: red.transparentize(50%))[half red]
#block(fill: red.transparentize(75%))[quarter red]
  ]
)
```typc
    self.transparentize(scale: ratio) → color
```
-- *scale*: ratio

用于修改透明度(alpha)值的系数。
- *opacify*<color_opacify>
按指定比例提高颜色的不透明度。

此方法基于现有的透明度(alpha)值进行计算。若比例值为正,则按 `alpha + scale - alpha * scale` 计算;比例值为负时,效果等同于 color.transparentize(-scale)。

#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(220)}
    ,
  [
    ```typst
#let half-red = red.transparentize(50%)
#block(fill: half-red.opacify(100%))[opaque]
#block(fill: half-red.opacify(50%))[three quarters red]
#block(fill: half-red.opacify(-50%))[one quarter red]
    ```
  ],
  [
    #set align(horizon)
    #let half-red = red.transparentize(50%)
#block(fill: half-red.opacify(100%))[opaque]
#block(fill: half-red.opacify(50%))[three quarters red]
#block(fill: half-red.opacify(-50%))[one quarter red]
  ]
)
```typc
    self.opacify(scale: ratio) → color
```
-- *scale*: ratio

用于修改透明度(alpha)值的系数。
- *spot*<color_spot>
可用于生成专色的专色着色剂。

在专业印刷环境中,可使用专色来指定精确颜料。创建好专色着色剂后,你可以利用其淡色方法生成各类颜色。

*构造函数*

创建一种新的专色着色剂。
```typc
color.spot(
    name: one str,
    fallback: color,
) → spot
```
-- *name*: one str

需使用的专色着色剂名称。

生产过程中,该名称将由人工核验并匹配对应的着色剂,因此该取值必须无歧义。最好引用PANTONE、HKS、RAL、Toyo以及DIC等色卡体系中的颜色。

生产时此处的值区分大小写:“PANTONE 2221 C”与“PANTONE 2221 c”会被视作两种不同颜色。请确保命名规则统一,要么引用色卡体系,要么与印刷生产专员协商确定。

若该值设为“all”,且印刷包含多个印版,使用该着色剂时,指定的淡色会均匀施加到全部印版上。若选择none,则使用此颜色时不会添加任何着色剂。该特殊取值常用于表示裁切或上光工艺。务必与印刷生产方沟通确认!

我们不建议使用“青色”“品红色”“黄色”“关键色”“黑色”这些名称,或是它们的本地语言译名。根据打印机型号不同,这些名称有可能会被识别为CMYK印刷四色,也有可能不会。
#table(

  columns: (0.5fr,1.5fr),
  align: left,
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"all\"],[使用所有可用的色版,而不是仅使用特定着色剂。]
)

-- *fallback*: color

如果指定的着色剂不可用,该如何渲染此颜色。

许多媒介(例如屏幕预览和家用打印机)无法使用这种特定专色着色剂。为了展示目标印刷效果的近似效果,会改用另一种可用的颜色。

*关于spot的定义*

-- *tint*

使用该着色剂,按指定淡印比例创建专色。

淡印比例代表着色剂的使用占比。100%的淡印比例表示以最高浓度使用着色剂,而0%则代表不使用任何着色剂。
#table(

  columns: (1fr,1fr),
  align: (left,center),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(86.27%)),
  [
    ```typst
#let pantone = color.spot(
  "PANTONE 2221 C",
  rgb("#239dad")
)

#square(fill: pantone.tint(100%))
#square(fill: pantone.tint(70%))
#square(fill: pantone.tint(40%))
```
  ],[
    #set align(horizon)
    #let pantone = color.spot(
  "PANTONE 2221 C",
  rgb("#239dad")
)

#square(fill: pantone.tint(100%))
#square(fill: pantone.tint(70%))
#square(fill: pantone.tint(40%))
  ]
)
```typc
    self.tint(value: ratio) → color
```
-- *value*: ratio

着色百分比,范围在0%至100%之间。

== 曲线(curve)<curve>
由移动、线条和贝塞尔曲线段组成的曲线。

在任意时刻,都存在一个概念上的画笔或光标。

-- 移动元素:移动光标,但不进行绘制。

-- 直线/二次/三次元素:从光标位置向新位置绘制一段线条,可附带贝塞尔曲线控制点。

-- 闭合元素:绘制一条直线或平滑线条,回到曲线起点或上一个最近的移动段起点。

出于布局需要,曲线的边界框是一个紧贴的矩形,包含所有线段以及坐标点(#text(fill: red,"0pt, 0pt"))。

位置可以采用绝对方式指定(即相对于(#text(fill: red,"0pt, 0pt"))),也可以相对于当前画笔/光标位置,也就是上一段线段的终点位置。

贝塞尔曲线控制点可通过传入#text(fill: red,"none") 予以省略,或传入#text(fill: red,"auto"),由上一段线段自动镜像生成。
=== 示例(Example)
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#curve(

  fill: blue.lighten(80%),
  stroke: blue,
  curve.move((0pt, 50pt)),
  curve.line((100pt, 50pt)),
  curve.cubic(none, (90pt, 0pt), (50pt, 0pt)),
  curve.close(),
)
    ```
  ],
  [
    #set align(horizon+center)
    #curve(

  fill: blue.lighten(80%),
  stroke: blue,
  curve.move((0pt, 50pt)),
  curve.line((100pt, 50pt)),
  curve.cubic(none, (90pt, 0pt), (50pt, 0pt)),
  curve.close(),
)
  ]
)
=== 参数(Parameters)
```typc
curve(
    fill: none color gradient tiling,
    fill-rule: str,
    stroke: none auto length color gradient stroke tiling dictionary,
    components: ..content,
) → content
```
- *fill*: none color gradient tiling
如何填充曲线。默认值:```typc none```。

设置填充时,默认描边会消失。若要创建同时带有填充和描边的曲线,你需要对两者都进行设置。
- *fill-rule*: str<curve_fill-rule>
用于填充曲线的绘制规则。默认值:```typc none-zero```。
#table(

  columns: (1fr,1fr),
  align: (left,center),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
// We use `.with` to get a new
// function that has the common
// arguments pre-applied.
#let star = curve.with(
  fill: red,
  curve.move((25pt, 0pt)),
  curve.line((10pt, 50pt)),
  curve.line((50pt, 20pt)),
  curve.line((0pt, 20pt)),
  curve.line((40pt, 50pt)),
  curve.close(),
)

#star(fill-rule: "non-zero")
#star(fill-rule: "even-odd")
```
  ],[
    #set align(horizon)
    #let star = curve.with(
  fill: red,
  curve.move((25pt, 0pt)),
  curve.line((10pt, 50pt)),
  curve.line((50pt, 20pt)),
  curve.line((0pt, 20pt)),
  curve.line((40pt, 50pt)),
  curve.close(),
)

#star(fill-rule: "non-zero")
#star(fill-rule: "even-odd")
    //#image("images/7023.png",width: auto)
  ]
)
#table(

  columns: (0.5fr,1.5fr),
  align: left,
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"non-zero\"],[指定通过带符号边相交次数的非零和来计算“内部”。],
  [\"even-odd\"],[指定通过奇数次边相交来计算“内部”。],
)
- *stroke*: none auto length color gradient stroke tiling dictionary<curve_stroke>
如何[绘制]曲线描边。默认值:```typc auto```。

可设置为none以关闭描边,或设置为auto:当且仅当未设置填充时,将使用1磅黑色描边。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let down = curve.line((40pt, 40pt), relative: true)
#let up = curve.line((40pt, -40pt), relative: true)

#curve(

  stroke: 4pt + gradient.linear(red, blue),
  down, up, down, up, down,
)
    ```
  ],
  [
    #set align(horizon+center)
    #let down = curve.line((40pt, 40pt), relative: true)
#let up = curve.line((40pt, -40pt), relative: true)

#curve(

  stroke: 4pt + gradient.linear(red, blue),
  down, up, down, up, down,
)
    //#image("images/7024.png",width: 100%)
  ]
)
- *components*: content
曲线的组成部分包括移动点、直线段和贝塞尔曲线段,并且形成闭合图形。
=== 定义(Definitions)
- *move*<curve_move>
新建一个曲线组件。

如果未传入 curve.move 参数,曲线将从坐标(0pt, 0pt)处开始绘制。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#curve(

  fill: blue.lighten(80%),
  fill-rule: "even-odd",
  stroke: blue,
  curve.line((50pt, 0pt)),
  curve.line((50pt, 50pt)),
  curve.line((0pt, 50pt)),
  curve.close(),
  curve.move((10pt, 10pt)),
  curve.line((40pt, 10pt)),
  curve.line((40pt, 40pt)),
  curve.line((10pt, 40pt)),
  curve.close(),
)
```
  ],[
    #set align(horizon)
    #curve(

      fill: blue.lighten(80%),
      fill-rule: "even-odd",
      stroke: blue,
      curve.line((50pt, 0pt)),
      curve.line((50pt, 50pt)),
      curve.line((0pt, 50pt)),
      curve.close(),
      curve.move((10pt, 10pt)),
      curve.line((40pt, 10pt)),
      curve.line((40pt, 40pt)),
      curve.line((10pt, 40pt)),
      curve.close(),
    )
    //#image("images/7025.png",width: auto)
  ]
)
```typc
curve.move(
    start: array,
    relative: bool,
) → content
```
-- *start*: array

新组件的起点。

-- *relative*: bool

坐标是否相对于上一个点。默认值:```typc false```。

- *line(直线)*<curve_line>
从当前点向后续点添加一条直线。
#table(

  columns: (1fr,1fr),
  align: (left,center),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(86.27%)),
  [
    ```typst
#curve(

  stroke: blue,

  curve.line((50pt, 0pt)),
  curve.line((50pt, 50pt)),
  curve.line((100pt, 50pt)),
  curve.line((100pt, 0pt)),
  curve.line((150pt, 0pt)),
)
```
  ],[
    #set align(horizon)
    #image("images/7026.png",width: auto)
  ]
)
```typc
curve.line(
    end: array,
    relative: bool,
) → content
```

-- *end*: array

线条终止的位置。

-- *relative*: bool

坐标是否相对于上一个点。默认值:```typc false```。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#curve(

  stroke: blue,

  curve.move((50pt,0pt)),
  curve.line((50pt, 0pt), relative: true),
  curve.line((0pt, 50pt), relative: true),
  curve.line((50pt, 0pt), relative: true),
  curve.line((0pt, -50pt), relative: true),
  curve.line((50pt, 0pt), relative: true),
)
    ```
  ],
  [
    #curve(

  stroke: blue,

  curve.move((50pt,0pt)),
  curve.line((50pt, 0pt), relative: true),
  curve.line((0pt, 50pt), relative: true),
  curve.line((50pt, 0pt), relative: true),
  curve.line((0pt, -50pt), relative: true),
  curve.line((50pt, 0pt), relative: true),
)
  ]
)
- *quad(二次贝塞尔曲线)*
新增一条二次贝塞尔曲线片段,从最后一个点绘制至终点,以control作为控制点。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
    #curve(

      stroke: blue,

      curve.move((20pt,20pt)),
      curve.quad((50pt, 180pt),(300pt,80pt)),
    )
    ```
  ],
  [
    #curve(

  stroke: blue,

  curve.move((20pt,20pt)),
  curve.quad((50pt, 180pt),(300pt,80pt)),
)
  ]
)
```typc
curve.quad(
    control: none auto array,
    end: array,
    relative: bool,
) → content
```
-- *control*: none auto array

二次贝塞尔曲线的控制点。

(1) 若设为自动,且该线段紧随另一条二次贝塞尔曲线,则会镜像上一个控制点。

(2) 若设为无,控制点默认为终点,曲线将变为一条直线。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
    #curve(

      stroke: 2pt,

      curve.quad((20pt, 40pt), (40pt, 40pt), relative: true),
      curve.quad(auto, (40pt, -40pt), relative: true),
    )
    ```
  ],
  [
    #curve(

      stroke: 2pt,

      curve.quad((20pt, 40pt), (40pt, 40pt), relative: true),
      curve.quad(auto, (40pt, -40pt), relative: true),
    )
  ]
)
-- *end*: array

该线段的终止点。

-- *relative*: bool

控制坐标与终点坐标是否相对于上一个点。默认值:```typc false```。

- *cubic(三次贝塞尔曲线)*<curve_cubic>
从最后一个点到终点添加一条三次贝塞尔曲线段,以起点控制点和终点控制点作为控制点。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
    // Function to illustrate where the control points are.
    #let handle(start, end) = place(
      line(stroke: red, start: start, end: end)
    )

    #handle((0pt, 80pt), (10pt, 20pt))
    #handle((90pt, 60pt), (100pt, 0pt))

    #curve(

      stroke: blue,

      curve.move((0pt, 80pt)),
      curve.cubic((10pt, 20pt), (90pt, 60pt), (100pt, 0pt)),
    )
    ```
  ],
  [
    // Function to illustrate where the control points are.
    #let handle(start, end) = place(
      line(stroke: red, start: start, end: end)
    )

    #handle((0pt, 80pt), (10pt, 20pt))
    #handle((90pt, 60pt), (100pt, 0pt))

    #curve(

      stroke: blue,

      curve.move((0pt, 80pt)),
      curve.cubic((10pt, 20pt), (90pt, 60pt), (100pt, 0pt)),
    )
  ]
)
```typc
curve.cubic(
    control-start: none auto array,
    control-end:none array,
    end: array,
    relative: bool,
) → content
```
-- *control-start*: none auto array

曲线段起点向外延伸的控制点。

(1) 若设为自动,且该元素紧跟另一个三次曲线元素,则上一个控制点会被镜像。用SVG术语来说,这会让三次曲线的行为类似S运算符,而非C运算符。

(2) 若设为无,则该曲线没有第一个控制点,或者等效地,控制点默认为曲线的起点。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  // - No start control point
  // - End control point at `(20pt, 0pt)`
  // - End point at `(50pt, 0pt)`
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // - No start control point
  // - No end control point
  // - End point at `(50pt, 0pt)`
  curve.cubic(none, none, (100pt, 50pt)),
)

#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // Passing `auto` instead of `none` means the start control point
  // mirrors the end control point of the previous curve. Mirror of
  // `(20pt, 0pt)` w.r.t `(50pt, 0pt)` is `(80pt, 0pt)`.
  curve.cubic(auto, none, (100pt, 50pt)),
)

#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // `(80pt, 0pt)` is the same as `auto` in this case.
  curve.cubic((80pt, 0pt), none, (100pt, 50pt)),
)
    ```
  ],
  [
#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  // - No start control point
  // - End control point at `(20pt, 0pt)`
  // - End point at `(50pt, 0pt)`
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // - No start control point
  // - No end control point
  // - End point at `(50pt, 0pt)`
  curve.cubic(none, none, (100pt, 50pt)),
)

#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // Passing `auto` instead of `none` means the start control point
  // mirrors the end control point of the previous curve. Mirror of
  // `(20pt, 0pt)` w.r.t `(50pt, 0pt)` is `(80pt, 0pt)`.
  curve.cubic(auto, none, (100pt, 50pt)),
)

#curve(

  stroke: blue,

  curve.move((0pt, 50pt)),
  curve.cubic(none, (20pt, 0pt), (50pt, 0pt)),
  // `(80pt, 0pt)` is the same as `auto` in this case.
  curve.cubic((80pt, 0pt), none, (100pt, 50pt)),
)

  ]
)
-- *control-end*:none array

曲线段终点处的控制点。

若设置为无,则该曲线没有终点控制点,等价于控制点默认为曲线的终点。

-- *end*: array

曲线段的终止点。

-- *relative*: bool

控制起点、控制终点以及结束坐标是否相对于前一个点。默认值:```typc false```。

- *close*
通过增加一条从最后一个点到曲线起点(或上一个curve.move的最后一个点)的线段来闭合曲线。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
// We define a function to show the same shape with
// both closing modes.
#let shape(mode: "smooth") = curve(
  fill: blue.lighten(80%),
  stroke: blue,
  curve.move((0pt, 50pt)),
  curve.line((100pt, 50pt)),
  curve.cubic(auto, (90pt, 0pt), (50pt, 0pt)),
  curve.close(mode: mode),
)

#shape(mode: "smooth")
#shape(mode: "straight")

    ```
  ],
  [
    // We define a function to show the same shape with
    // both closing modes.
    #let shape(mode: "smooth") = curve(
      fill: blue.lighten(80%),
      stroke: blue,
      curve.move((0pt, 50pt)),
      curve.line((100pt, 50pt)),
      curve.cubic(auto, (90pt, 0pt), (50pt, 0pt)),
      curve.close(mode: mode),
    )

    #shape(mode: "smooth")
    #shape(mode: "straight")
  ]
)
```typc
    curve.close(mode: str) → content
```
-- *mode*: str

如何闭合曲线。默认值:```typc smooth```。
#table(

  columns: (0.5fr,2fr),
  align: left,
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"smooth\"],[采用平滑线段闭合曲线,该线段会考虑起点对侧的控制点。],
  [\"straight\"],[用直线闭合曲线。],
)

== 椭圆(ellipse)<ellipse>
可附带可选内容的椭圆。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
// Without content.
#ellipse(width: 35%, height: 30pt)

// With content.
#ellipse[
  #set align(center)
  Automatically sized \
  to fit the content.
]
```
  ],[
      // Without content.
      #ellipse(width: 35%, height: 30pt)

      // With content.
      #ellipse[
        #set align(center)
        Automatically sized \
        to fit the content.
      ]
  ]
)
=== 参数(Parameters)
```typc
ellipse(
    width: auto relative,
    height: auto relative fraction,
    fill: none color gradient tiling,
    stroke: none auto length color gradient stroke tiling dictionary,
    inset: relative dictionary,
    outset: relative dictionary,
    body: none content,
) → content
```
- *width*: auto relative
椭圆相对于其父容器的宽度。默认值:```typc auto```。
- *height*: auto relative fraction
椭圆相对于其父容器的高度。默认值:```typc auto```。
- *fill*: none color gradient tiling
如何填充椭圆。更多详情请参阅矩形的相关文档。默认值:```typc none```。
- *stroke*: none auto length color gradient stroke tiling dictionary
如何绘制椭圆轮廓。更多详情请参阅矩形的文档。默认值:```typc auto```。
- *inset*: relative dictionary
椭圆内容应填充多少。更多详情请参阅#link(<box>)[盒子]的文档。默认值:```typc 0%+5pt```。
- *outset*: relative dictionary
在不影响布局的前提下,椭圆尺寸需要扩大多少。更多详情请参阅#link(<box>)[盒子]的文档说明。默认值:```typc (:)```。
- *body*: none content
放入椭圆内的内容。默认值:```typc none```。

当省略此项时,椭圆将采用默认尺寸,最大为45pt×30pt。

== 渐变(gradient)<gradient>
颜色渐变。

Typst通过gradient.linear函数支持线性渐变,通过gradient.radial函数支持径向渐变,通过gradient.conic函数支持圆锥渐变。

渐变可用于以下目的:

-- 作为填充来绘制形状的内部:```typc rect(fill: gradient.linear(..))```

-- 作为绘制形状轮廓的笔划:```typc rect(stroke: 1pt + gradient.linear(..))```

-- 作为文本填充:```typc set text(fill: gradient.linear(..))```

-- 作为一张颜色映射,你可以用以下方法采样:```typc gradient.linear(..).sample(50%)```
=== 示例(Examples)
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#stack(

  dir: ltr,

  spacing: 1fr,

  square(fill: gradient.linear(..color.map.rainbow)),
  square(fill: gradient.radial(..color.map.rainbow)),
  square(fill: gradient.conic(..color.map.rainbow)),
)
    ```
  ],
  [
    #stack(

      dir: ltr,

      spacing: 1fr,

      square(fill: gradient.linear(..color.map.rainbow)),
      square(fill: gradient.radial(..color.map.rainbow)),
      square(fill: gradient.conic(..color.map.rainbow)),
    )
  ]
)
文本同样支持渐变效果,但仅在将 relativeness属性设置为 #text(fill: red,"auto")(默认值)或 "#text(fill: red,"parent")" 时生效。如果想要实现逐词或逐字符的渐变,你可以手动将文字或字符放入#link(<box>)[容器]内,也可以通过#link(<Styling-show>)[show规则]来实现。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set text(fill: gradient.linear(red, blue))
#let rainbow(content) = {
  set text(fill: gradient.linear(..color.map.rainbow))
  box(content)
}

This is a gradient on text, but with a #rainbow[twist]!

    ```
  ],
  [
#set text(fill: gradient.linear(red, blue))
#let rainbow(content) = {
  set text(fill: gradient.linear(..color.map.rainbow))
  box(content)
}

This is a gradient on text, but with a #rainbow[twist]!
  ]
)
=== 色标(Stops)<gradient_stops>
渐变由一系列色标组成。每个色标都包含一种颜色和一个偏移量。偏移量可以是介于#rtext[0%]到#rtext[100%]之间的#link(<ratio>)[比例],或是#rtext[0]度到#rtext[360]度之间的角度。偏移量是相对位置,用于确定该色标在渐变中的位置。色标的颜色就是渐变在该位置处呈现的颜色。定义渐变时可以省略偏移量,这种情况下,Typst会均匀分布所有色标。

Typst预定义了若干颜色映射,可直接用作色标。更多信息请查阅#link(<color>)[颜色]相关文档。

=== 相对性(Relativeness)<gradient_Relativeness>
0%和100%色标停止点的位置取决于容器的尺寸。该容器可以是正在被绘制的图形本身,或是距离最近的外层容器。这一点由渐变构造函数的relative参数控制。默认情况下,渐变相对于正在绘制的图形;但如果渐变应用于文本,则渐变会相对于最近的父级容器。

Typst 按以下方式确定父级容器:

-- 对于放置在文档根级/顶层的图形,其最近父级就是页面本身。

-- 对于其他图形,父级为包含该图形的最内层#link(<block>)[块]或#link(<box>)[盒子]。

=== 色彩空间与插值(Color spaces and interpolation)<gradient_Color-spaces-and-interpolation>
渐变可以在任意色彩空间中进行插值。默认情况下,渐变会在#link(<color_oklab>)[Oklab]色彩空间内插值,这是一个#link("https://programmingdesignsystems.com/color/perceptually-uniform-color-spaces/index.html")[感知均匀]的色彩空间。这代表人眼会觉得该渐变的色彩过渡平滑。这一点在数据可视化场景中尤其实用。

不过,你可以自行选择在任意受支持的色彩空间中对渐变进行插值,但需要注意:部分色彩空间并不适合用于色彩之间的感知插值。选择插值空间时,请参考下方表格。
#table(

  columns: (1fr,1fr),
  stroke: none,
  table.header([*Color space*],[*Perceptually uniform?*]),
  table.hline(),
  [#link(<color_oklab>)[Oklab]],[Yes],
  [#link(<color_oklch>)[Oklch]],[Yes],
  [#link(<color_rgb>)[sRGB]],[No],
  [#link(<color_linear-rgb>)[linear-RGB]],[Yes],
  [#link(<color_cmyk>)[CMYK]],[No],
  [#link(<color_luma>)[Grayscale]],[Yes],
  [#link(<color_hsl>)[HSL]],[No],
  [#link(<color_hsv>)[HSV]],[No],
)
#figure(

  image("images/7028.png")
)
=== 方向(Direction)<gradient_Direction>
部分渐变对方向敏感。例如,线性渐变拥有一个角度,该角度决定它的方向。Typst 使用顺时针角度,0°代表从左到右,90°代表从上到下,180°代表从右到左,270°代表从下到上。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#stack(

  dir: ltr,

  spacing: 1fr,

  square(fill: gradient.linear(red, blue, angle: 0deg)),
  square(fill: gradient.linear(red, blue, angle: 90deg)),
  square(fill: gradient.linear(red, blue, angle: 180deg)),
  square(fill: gradient.linear(red, blue, angle: 270deg)),
)
    ```
  ],
  [
#stack(

  dir: ltr,

  spacing: 1fr,

  square(fill: gradient.linear(red, blue, angle: 0deg)),
  square(fill: gradient.linear(red, blue, angle: 90deg)),
  square(fill: gradient.linear(red, blue, angle: 180deg)),
  square(fill: gradient.linear(red, blue, angle: 270deg)),
)
  ]
)
=== 文件大小说明(Note on file sizes)<gradient_Note-on-file-sizes>
渐变的数据量可能会相当大,尤其是在包含大量色标时。这是因为渐变是以颜色和偏移量列表的形式存储的,会占用大量空间。在导出SVG时,渐变会以#link(<color_rgb>)[color.rgb]颜色列表保存,还原原始色彩空间,并在中间添加经过数量优化的额外色标。在导出PDF时,对于#link(<color_oklab>)[color.oklab]、#link(<color_oklch>)[color.oklch]、#link(<color_hsv>)[color.hsv]、#link(<color_hsl>)[color.hsl]以及#link(<color_linear-rgb>)[color.linear-rgb]色彩空间下的渐变,处理方式相同。这样就无需在PDF文件中对这些色彩空间进行编码,但会为渐变增加额外色标,进而增大文件体积。
=== 定义(Definitions)
- *linear*<gradient_linear>
创建一个新的线性渐变,其中颜色沿一条直线过渡。
#table(

  columns: (1fr,1fr),
  align: (left,left),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#rect(

  width: 100%,

  height: 20pt,

  fill: gradient.linear(

    ..color.map.viridis,

  ),
)
```
  ],[
    #set align(horizon)
    #rect(

      width: 100%,

      height: 20pt,

      fill: gradient.linear(

        ..color.map.viridis,

      ),
    )
  ]
)
```typc
gradient.linear(
    stops: ..color array,
    space: auto spot any,
    relative: auto str,
    dir: direction,
    angle: angle,
) → gradient
```
-- *stops*: color array

渐变的#link(<gradient_stops>)[色标]。

-- *space*: auto spot any

用于对渐变进行插值的色彩空间。默认值:```typc auto```。

默认使用名为 #link(<color_oklab>)[Oklab] 的感知均匀色彩空间。

-- *relative*: auto str

渐变的#link(<gradient_Relativeness>)[相对位置]。默认值:```typc auto```。

元素的父级是包含该元素的最内层#link(<box>)[盒子]或#link(<block>)[块];如果不存在,则为页面本身。
#table(

  columns: (1fr,2fr),
  stroke: none,
  table.header([*Variant*],[*PDetails*]),
  table.hline(),
  [\"self\"],[相对于其自身(自身包围盒)。],
  [\"parent\"],[相对于其父对象(父对象的边界框)。],
)
-- *dir*: direction

渐变的方向。默认值:```typc ltr```。

-- *angle*: angle

渐变的角度。

- *radial*<gradient_radial>
创建一个新的径向渐变,颜色从中心点向外辐射。

该渐变由两个圆定义:焦点圆和终止圆。焦点圆是以焦点中心点为圆心、焦点半径为半径的圆,用于标记渐变的起始位置,该位置使用第一个色标对应的颜色。终止圆是以中心点为圆心、半径为半径的圆,用于标记渐变的结束位置,该位置使用最后一个色标对应的颜色。渐变将在这两个圆之间进行插值计算。

借助这四个参数(即起始圆的焦点,以及终止圆的圆心和半径),我们可以定义出属性比基础径向渐变更加丰富的渐变效果。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#stack(

  dir: ltr,

  spacing: 1fr,

  circle(fill: gradient.radial(

    ..color.map.viridis,

  )),
  circle(fill: gradient.radial(
    ..color.map.viridis,
    focal-center: (10%, 40%),
    focal-radius: 5%,
  )),
)
```
  ],[
    #stack(

      dir: ltr,

      spacing: 1fr,

      circle(fill: gradient.radial(

        ..color.map.viridis,

      )),
      circle(fill: gradient.radial(
        ..color.map.viridis,
        focal-center: (10%, 40%),
        focal-radius: 5%,
      )),
    )
  ]
)
```typst
gradient.radial(
    stops:..color array,
    space: auto spot any,
    relative: auto str,
    center: array,
    radius: ratio,
    focal-center: auto array,
    focal-radius: ratio,
) → gradient
```
-- *stops*: color array

渐变的#link(<gradient_stops>)[色标]。

-- *space*: auto spot any

用于对渐变进行插值的色彩空间。默认值:```typc auto```。

默认使用名为#link(<color_oklab>)[Oklab]的感知均匀色彩空间。

-- *relative*: auto str

渐变的#link(<gradient_Relativeness>)[相对位置]。默认值:```typc auto```。

元素的父级是包含该元素的最内层#link(<box>)[盒子]或#link(<block>)[块];如果不存在,则为页面本身。
#table(

  columns: (1fr,2fr),
  stroke: none,
  table.header([*Variant*],[*PDetails*]),
  table.hline(),
  [\"self\"],[相对于其自身(自身包围盒)。],
  [\"parent\"],[相对于其父对象(父对象的边界框)。],
)

-- *center*: array

渐变终止圆的圆心。默认值:```typc center```。

取值(#rtext[50%], #rtext[50%])代表终止圆在其容器内居中。

-- *radius*: ratio

渐变终止圆的半径。默认值:```typc 50%```。

默认值设为#rtext()[50%]。终止半径必须大于焦点半径。

-- *focal-center*: auto array

渐变焦点圆的中心。默认值:```typc auto```。

焦点中心必须位于终止圆内部。

(#rtext[50%], #rtext[50%]) 这个值代表焦点圆以其容器中心为圆心。

默认情况下,该值与最后一个圆的中心保持一致。

-- *focal-radius*: ratio

渐变焦点圆的半径。默认值:```typc 0%```。

焦点中心必须位于终止圆内部。

默认设置为#rtext[0%]。焦点半径必须小于终止半径。

- *conic*<gradient_conic>
创建新的圆锥渐变,其中颜色围绕中心点呈径向变化。

你可以通过 center 参数控制渐变的中心点。默认情况下,中心点为形状的中心。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#stack(

  dir: ltr,

  spacing: 1fr,

  circle(fill: gradient.conic(

    ..color.map.viridis,

  )),
  circle(fill: gradient.conic(
    ..color.map.viridis,
    center: (20%, 30%),
  )),
)
```
  ],[
#stack(

  dir: ltr,

  spacing: 1fr,

  circle(fill: gradient.conic(

    ..color.map.viridis,

  )),
  circle(fill: gradient.conic(
    ..color.map.viridis,
    center: (20%, 30%),
  )),
)
  ]
)
```typc
gradient.conic(
    stops: ..color array,
    angle: angle,
    space: auto spot any,
    relative: auto str,
    center: array,
) → gradient
```
-- *stops*: color array

渐变的#link(<gradient_stops>)[色标]。

-- *angle*: angle

渐变的角度。默认值:```typc 0deg```。

-- *space*: auto spot any

用于对渐变进行插值的色彩空间。默认值:```typc auto```。

-- *relative*: auto str

渐变的#link(<gradient_Relativeness>)[相对位置]。默认值:```typc auto```。

元素的父级是包含该元素的最内层#link(<box>)[盒子]或#link(<block>)[块];如果不存在,则为页面本身。
#table(

  columns: (1fr,2fr),
  stroke: none,
  table.header([*Variant*],[*PDetails*]),
  table.hline(),
  [\"self\"],[相对于其自身(自身包围盒)。],
  [\"parent\"],[相对于其父对象(父对象的边界框)。],
)

-- *center*: array

渐变终止圆的圆心。默认值:```typc (50%,50%)```。

取值(#rtext[50%], #rtext[50%])代表终止圆在其容器内居中。

- *sharp*<gradient_sharp>
生成该渐变的锐化版本。

锐化渐变的颜色之间存在离散突变,而非平滑过渡。它们对于创建预设渐变的颜色列表尤其有用。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set rect(width: 100%, height: 20pt)
#let grad = gradient.linear(..color.map.rainbow)
#rect(fill: grad)
#rect(fill: grad.sharp(5))
#rect(fill: grad.sharp(5, smoothness: 20%))

    ```
  ],
  [
#set rect(width: 100%, height: 20pt)
#let grad = gradient.linear(..color.map.rainbow)
#rect(fill: grad)
#rect(fill: grad.sharp(5))
#rect(fill: grad.sharp(5, smoothness: 20%))
  ]
)
```typst
self.sharp(
    steps: int,
    smoothness: ratio,
) → gradient
```
-- *steps*: int

渐变的色标数。

-- *smoothness*: ratio,

渐变的光滑度。默认值:```typc 0%```。
- *repeat*<gradient_repeat>
将该渐变重复指定次数,可选择在每第二次重复时对其进行镜像翻转。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#circle(

  radius: 40pt,

  fill: gradient

    .radial(aqua, white)
    .repeat(4),
)
```
  ],[
#circle(

  radius: 40pt,

  fill: gradient

    .radial(aqua, white)
    .repeat(4),
)
  ]
)
```typst
self.repeat(
    repetitions: int,
    mirror: bool,
) → gradient
```
-- *repetitions*: int

渐变重复次数。

-- *mirror*: bool

是否在每第二次重复时对梯度进行镜像处理,即第一次实例(以及所有奇数次实例)保持不变。默认值:```typc false```。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#circle(

  radius: 40pt,

  fill: gradient

    .conic(green, black)
    .repeat(2, mirror: true)
)

```
  ],[
#circle(

  radius: 40pt,

  fill: gradient

    .conic(green, black)
    .repeat(2, mirror: true)
)

  ]
)
- *kind*<gradient_kind>
返回该渐变的类型。
```typst
self.kind() → function
```
- *stops*
返回此渐变的色标。
```typst
self.stops() → array
```
- *space*<gradient_space>
返回此渐变的混合空间。
```typst
self.space() → spot any
```
- *relative*<gradient_relative>
返回此渐变的相对位置。
```typst
self.relative() → auto str
```
- *angle*<gradient_angle>
返回此渐变的角度。

如果该渐变既不是线性渐变也不是圆锥渐变,则返回空值。
```typst
self.angle() → none angle
```
- *center*<gradient_center>
返回此渐变的中心点。

如果该渐变既不是径向渐变也不是圆锥渐变,则返回空值。
```typst
self.center() → none array
```
- *radius*<gradient_radius>
返回此渐变的半径。

如果该渐变不是径向渐变,则返回空。
```typst
self.radius() → none ratio
```
- *focal-center*<gradient_focal-center>
返回此渐变的焦点中心。

如果该渐变不是径向渐变,则返回空。
```typst
self.focal-center() → none array
```
- *focal-radius*<gradient_focal-radius>
返回此渐变的焦点半径。

如果该渐变不是径向渐变,则返回空。
```typst
self.focal-radius() → none ratio
```
- *sample*<gradient_sample>
在指定位置对渐变进行采样。

该位置可以是渐变上的位置(0%到100%之间的比例值),也可以是一个角度。超出此范围的所有数值都将被限制在区间内。
```typst
self.sample(t: angle ratio) → color
```
- *samples*<gradient_samples>
一次性在多个位置对渐变进行采样,并以数组形式返回结果。
```typst
self.samples(ts: ..angle ratio) → array
```
-- *ts*: angle ratio
用于采样渐变的位置。

== 图像(image)<image>
光栅图形或矢量图形。

你可以将图片放置在figure标签内,为其添加编号与图注。

和大多数元素一样,图片默认是块级元素,因此不会嵌入相邻段落。若要强制让图片变为行内元素,可将其放入容器中。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#figure(

  image("images/molecular.png", width: 80%),
  caption: [
    A step in the molecular testing
    pipeline of our lab.
  ],
)
```
  ],[
#figure(

  image("images/molecular.png", width: 80%),
  caption: [
    A step in the molecular testing
    pipeline of our lab.
  ],
)
  ]
)
=== 参数(Parameters)
```typc
image(
    source: str path bytes,
    format: auto str dictionary,
    width: auto relative,
    height: auto relative fraction,
    alt: none str,
    page: int,
    fit: str,
    scaling: auto str,
    icc: auto str path bytes,
) → content
```
- *source*: str path bytes<image_source>
图像文件的路径,或是采用支持格式之一构成图像的原始字节数据。

字节可用于指定行优先、从左至右、从上到下格式的原始像素数据。

- *format*: auto str dictionary<image_format>\ 图像的格式。默认值:```typc auto```。\ 默认情况下会自动检测格式。通常,仅当以原始字节作为源时才需要指定格式(即便在这种情况下,Typst 也会尝试自动识别格式,但并非总能成功)。\ 支持的格式有 "png"、"jpg"、"gif"、"svg"、"pdf"、"webp",以及原始像素数据。\ 请注意,将PDF文件作为图像使用时有多项限制:
  - 导出为PDF时,所使用的PDF图像文件版本必须等于或低于导出目标PDF版本。
  - 在按特定PDF标准(如PDF/A-3或PDF/UA-1)导出时,目前不支持将PDF文件用作图像。这种情况下,你可以改用SVG嵌入矢量图像。
  - 该图像文件不得设置密码保护。
  - PDF图像内的标签不会被保留。你必须提供替代描述,保障图像的无障碍访问。\ 在将原始像素数据作为源提供时,你必须指定一个包含以下键的字典作为格式:
  - 编码(字符串):像素数据的编码格式。可选值如下:
    - "rgb8"(3个8位通道:红、绿、蓝)
    - "rgba8"(4个8位通道:红、绿、蓝、阿尔法)
    - "luma8"(1个8位通道)
    - "lumaa8"(2个8位通道:亮度和阿尔法)
  - 宽度(整数):图像的像素宽度。
  - 高度(整数):图像的像素高度。

指定编码下,像素宽度乘以高度再乘以通道数的结果,必须与源数据一致。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#image(

  read(

    "images/tetrahedron.png",

    encoding: none,

  ),
  format: "png",
  width: 2cm,
)

#image(

  bytes(range(16).map(x => x * 16)),
  format: (
    encoding: "luma8",
    width: 4,
    height: 4,
  ),
  width: 2cm,
)
```
  ],[
#image(

  read(

    "images/tetrahedron.png",

    encoding: none,

  ),
  format: "png",
  width: 2cm,
)

#image(

  bytes(range(16).map(x => x * 16)),
  format: (
    encoding: "luma8",
    width: 4,
    height: 4,
  ),
  width: 2cm,
)
  ]
)
#table(

  columns: (0.5fr,2.5fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"png\"],[适用于插图与透明图形的光栅格式。],
  [\"jpg\"],[适用于照片的有损光栅格式。],
  [\"gif\"],[通常用于短视频片段的光栅格式。Typst可以加载GIF文件,但加载后会变为静态图像。],
  [\"webp\"],[支持有损压缩与无损压缩的光栅格式。],
  [\"svg\"],[网页所用的矢量图形格式。],
  [\"pdf\"],[网页所用的矢量图形格式。],
)
- *width*: auto relative<image_width>
图像的宽度。默认值:```typc auto```。
- *height*: auto relative fraction<image_height>
图像的高度。默认值:```typc auto```。
- *alt*: none str<image_alt>
图像的替代描述文本。默认值:```typc none```。

屏幕阅读器等辅助技术(AT)会使用该文本,向视障用户描述图像内容。

当图像放置在figure元素内时,请使用该参数描述图像,而不是figure元素的alt参数。唯一例外情况:图像与figure内其他内容构成单一语义单元。这种场景下,请使用figure元素的alt参数描述整体内容,不要使用本参数。

你可以在无障碍指南中学习如何编写优质的替代描述文本。
- *page*: int<image_page>
应作为图片嵌入的页码。该属性仅对PDF文件生效。默认值:```typc 1```。
- *fit*: str<image_fit>
图像应如何自适应到指定区域(该区域由宽度和高度字段定义)。默认值:```typc cover```。

请注意,如果区域的宽高比与图像的宽高比一致,fit参数不会产生任何视觉上的变化。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#image("images/tiger1.png", width: 80%, fit: "cover")
#image("images/tiger1.png", width: 80%, fit: "contain")
#image("images/tiger1.png", width: 80%, fit: "stretch")
    ```
  ],
  [
    #set align(center)
#image("images/tiger1.png", width: 80%, fit: "cover")
#image("images/tiger1.png", width: 100%, fit: "contain")
#image("images/tiger1.png", width: 100%, fit: "stretch")
  ]
)
#table(

  columns: (0.5fr,2.5fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"cover\"],[图片应完全铺满区域(仅通过横向或纵向裁剪图片来保持宽高比)。此为默认设置。],
  [\"contain\"],[图像应完整容纳在该区域内(保持宽高比;不裁剪图像;某一边尺寸可小于规定值)。],
  [\"stretch\"],[图像应进行拉伸以完全填满区域,即使这会造成图像变形(不保留宽高比,不对图像进行裁剪)。],
)
- *scaling*: auto str<image_scaling>
向查看者提示图像应如何缩放。默认值:```typc auto```。

设置为auto时,默认行为交由查看器决定。导出PNG时,Typst默认使用平滑缩放,与大多数PDF和SVG查看器一致。

注意:不同PDF查看器呈现的最终效果可能存在差异。
#table(

  columns: (0.5fr,2.5fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"smooth\"],[采用双线性插值等平滑算法进行缩放。],
  [\"pixelated\"],[使用最近邻算法或类似算法进行缩放,以保留图像的像素风格。],
)
- *icc*: auto str path bytes<image_icc>
图像的ICC配置文件。默认值:```typc auto```。

ICC配置文件规定如何解读图像中的颜色。设置为自动时,Typst将尝试从图像中提取ICC配置文件。

== 直线段(line)<line>
从一点到另一点的线段。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#line(length: 100%)
#line(end: (50%, 20%))
#line(

  length: 4cm,

  stroke: 2pt + maroon,

)
```
  ],[
//#set page(height: 100pt)

#line(length: 100%)
#line(end: (50%, 20%))
#line(

  length: 4cm,

  stroke: 2pt + maroon,

)
  ]
)
=== 参数(Parameters)
```typc
line(
    start: array,
    end: none array,
    length: relative,
    angle: angle,
    stroke: length color gradient stroke tiling dictionary,
) → content
```
- *start*: array
线段的起点。默认值:```typc (0%+0pt,0%+0pt)```。

必须是由恰好两个相对长度组成的数组。
- *end*: none array
线段终止的位置。默认值:```typc none```。
- *length*: relative
线段的长度。仅当end为#rtext[none]时,该参数才生效。默认值:```typc 0%+30pt```。
- *angle*: angle
直线偏离原点的角度。仅当end为#rtext[none]时该参数生效。默认值:```typc 0deg```。
- *stroke*: length color gradient stroke tiling dictionary
如何绘制线段。默认值:```typc 1pt+black```。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set line(length: 100%)
#stack(

  spacing: 1em,

  line(stroke: 2pt + red),
  line(stroke: (paint: blue, thickness: 4pt, cap: "round")),
  line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")),
  line(stroke: (paint: blue, thickness: 1pt, dash: ("dot", 2pt, 4pt, 2pt))),
)
    ```
  ],
  [
#set line(length: 100%)
#stack(

  spacing: 1em,

  line(stroke: 2pt + red),
  line(stroke: (paint: blue, thickness: 4pt, cap: "round")),
  line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")),
  line(stroke: (paint: blue, thickness: 1pt, dash: ("dot", 2pt, 4pt, 2pt))),
)
  ]
)
== 多边形(polygon)<polygon>
一个闭合多边形。

该多边形由顶点定义,并自动闭合。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#polygon(

  fill: blue.lighten(80%),
  stroke: blue,
  (20%, 0pt),
  (60%, 0pt),
  (80%, 2cm),
  (0%,  2cm),
)
```
  ],[
#polygon(

  fill: blue.lighten(80%),
  stroke: blue,
  (20%, 0pt),
  (60%, 0pt),
  (80%, 2cm),
  (0%,  2cm),
)

  ]
)
=== 参数(Parameters)
```typc
polygon(
    fill: none color gradient tiling,
    fill-rule: str,
    stroke: none auto length color gradient stroke tiling dictionary,
    vertices: ..array,
) → content
```
- *fill*: none color gradient tiling<polygon_fill>
如何填充多边形。默认值:```typc none```。

设置填充时,默认的描边会消失。要创建同时带有填充和描边的矩形,你需要对两者都进行配置。
- *fill-rule*: str<polygon_fill-rule>
用于填充多边形的绘制规则。默认值:```typc none-zero```。

有关示例,请参阅#link(<curve_fill-rule>)[曲线文档]。
#table(

  columns: (0.5fr,1.5fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"non-zero\"],[指定“内部”通过有符号边相交的非零和计算得出。],
  [\"even-odd\"],[指定通过奇数次边交叉来判定“内部”。],
)
- *stroke*: none auto length color gradient stroke tiling dictionary<polygon_stroke>
如何绘制多边形描边。默认值:```typc auto```。

可设置为#rtext[none]以关闭描边,或设置为#rtext[auto];当且仅当未设置填充时,auto代表1磅黑色描边。
- *vertices*: array
多边形的顶点。每个点由包含两个相对长度的数组指定。
=== 定义(Definitions)
- *regular*
由尺寸和顶点数量定义的正多边形。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#polygon.regular(
  fill: blue.lighten(80%),
  stroke: blue,
  size: 50pt,
  vertices: 3,
)
```
  ],[
#polygon.regular(
  fill: blue.lighten(80%),
  stroke: blue,
  size: 50pt,
  vertices: 3,
)
  ]
)
```typc
polygon.regular(
    fill: none color gradient tiling,
    stroke: none auto length color gradient stroke tiling dictionary,
    size: length,
    vertices: int,
) → content
```
-- *fill*: none color gradient tiling

如何填充多边形。更多详情请参阅通用#link(<polygon_fill>)[多边形的文档]。

-- *stroke*: none auto length color gradient stroke tiling dictionary

如何绘制多边形描边。更多详情请参阅通用#link(<polygon_stroke>)[多边形文档]。

-- *size*: length

正多边形#link("https://en.wikipedia.org/wiki/Circumcircle")[外接圆]的直径。默认值:```typc 1em```。

-- *vertices*: int

多边形的顶点数量。默认值:```typc 3```。

== 矩形(rect)<rect>
一个可附带可选内容的矩形。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
// Without content.
#rect(width: 35%, height: 30pt)

// With content.
#rect[
  Automatically sized \
  to fit the content.
]
```
  ],[
// Without content.
#rect(width: 35%, height: 30pt)

// With content.
#rect[
  Automatically sized \
  to fit the content.
]
  ]
)
=== 参数(Parameters)
```typc
rect(
    width: auto relative,
    height: auto relative fraction,
    fill: none color gradient tiling,
    stroke: none auto length color gradient stroke tiling dictionary,
    radius: relative dictionary,
    inset: relative dictionary,
    outset: relative dictionary,
    body: none content,
) → content
```
- *width*: auto relative<rect_width>
该矩形相对于其父容器的宽度。默认值:```typc auto```。
- *height*: auto relative fraction<rect_height>
该矩形相对于其父容器的高度。默认值:```typc auto```。
- *fill*: none color gradient tiling<rect_fill>
如何填充矩形。默认值:```typc none```。

设置填充时,默认描边会消失。要创建同时带有填充和描边的矩形,必须对两者都进行设置。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#rect(fill: blue)
```
  ],[
#rect(fill: blue)

  ]
)
- *stroke*: none auto length color gradient stroke tiling dictionary<rect_stroke>\ 如何绘制矩形描边。默认值:```typc auto```。\ 可选设置如下:
  - none:不启用描边
  - auto:仅当未设置填充时,自动使用1磅黑色描边
  - 任意类型的描边
  - 单独定义每条边描边的字典。该字典可包含以下优先级依次递减的键:
    - top:顶部笔画。
    - right:右侧笔画。
    - bottom:底部笔画。
    - left:左侧笔画。
    - x:左右笔画。
    - y:上下笔画。
    - 其余:除字典显式设置尺寸的边之外,其余各边的笔画。

所有关键词均为可选项;省略的关键词将使用其先前设置的值,若从未设置过则使用默认绘制。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#stack(

  dir: ltr,

  spacing: 1fr,

  rect(stroke: red),
  rect(stroke: 2pt),
  rect(stroke: 2pt + red),
)
```
  ],[
#stack(

  dir: ltr,

  spacing: 1fr,

  rect(stroke: red),
  rect(stroke: 2pt),
  rect(stroke: 2pt + red),
)

  ]
)
- *radius*: relative dictionary<rect_radius>\ 矩形圆角的圆化程度,取值相对于宽、高最小值的二分之一。默认值:```typc (:)```。\ 可设置为:
  - 相对长度:统一圆角半径。
  - 字典:使用字典时,可单独设置每条边的描边。字典可包含以下键,优先级顺序如下:
    - 左上角(top-left):左上角圆角半径。
    - 右上角(top-right):右上角圆角半径。
    - 右下角(bottom-right):右下角圆角半径。
    - 左下角(bottom-left):左下角圆角半径。
    - 左侧(left):左上角和左下角圆角半径。
    - 顶部(top):左上角和右上角圆角半径。
    - 右侧(right):右上角和右下角圆角半径。
    - 底部(bottom):左下角和右下角圆角半径。
    - 其余(rest):字典未显式设置尺寸的所有角的圆角半径。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#set rect(stroke: 4pt)
#rect(

  radius: (

    left: 5pt,

    top-right: 20pt,

    bottom-right: 10pt,

  ),
  stroke: (
    left: red,
    top: yellow,
    right: green,
    bottom: blue,
  ),
)
```
  ],[
#set rect(stroke: 4pt)
#rect(

  radius: (

    left: 5pt,

    top-right: 20pt,

    bottom-right: 10pt,

  ),
  stroke: (
    left: red,
    top: yellow,
    right: green,
    bottom: blue,
  ),
)
  ]
)
- *inset*: relative dictionary<rect_inset>
矩形内容的内边距大小。更多详情请参阅#link(<box_inset>)[盒子相关文档]。默认值:```typc 0%+5pt```。
- *outset*: relative dictionary<rect_outset>
在不影响布局的前提下,矩形尺寸可以扩充多少。更多详情请参阅#link(<box_outset>)[盒子相关文档]。默认值:```typc (:)```。
- *body*: none content
要放入矩形内的内容。默认值:```typc none```。

如果省略此项,矩形将采用默认尺寸,最大为45磅×30磅。

== 正方形(square)<square>
一个可附带可选内容的正方形。
=== 示例(Example)
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
// Without content.
#square(size: 40pt)

// With content.
#square[
  Automatically \
  sized to fit.
]
```
  ],[
// Without content.
#square(size: 40pt)

// With content.
#square[
  Automatically \
  sized to fit.
]
  ]
)
=== 参数(Parameters)
```typc
square(
    size: auto length,
    width: auto relative,
    height: auto relative fraction,
    fill: none color gradient tiling,
    stroke: none auto length color gradient stroke tiling dictionary,
    radius: relative dictionary,
    inset: relative dictionary,
    outset: relative dictionary,
    body: none content,
) → content
```
- *size*: auto length<square_size>
正方形的边长。该参数与宽度、高度互斥。默认值:```typc auto```。
- *width*: auto relative<square_width>
正方形的宽度。该属性与size和height互斥。默认值:```typc auto```。

与size不同,该值可以相对于父容器的宽度进行设置。
- *height*: auto relative fraction<square_height>
该正方形的高度。此属性与size、width互斥。默认值:```typc auto```。

与size不同,该值可以相对于父容器的高度进行设置。
- *fill*: none color gradient tiling<square_fill>
如何填充正方形。更多详情请参阅#link(<rect_fill>)[矩形的文档]。默认值:```typc none```。
- *stroke*: none auto length color gradient stroke tiling<square_stroke>
如何绘制正方形描边。更多详情请参阅#link(<rect_stroke>)[矩形的文档]。默认值:```typc auto```。
- *radius*: relative dictionary<square_radius>
正方形边角的圆角程度。更多详情请参阅#link(<rect_radius>)[矩形相关文档]。默认值:```typc (:)```。
- *inset*: relative dictionary<square_inset>
正方形内容的内边距大小。更多详情请参阅#link(<box_inset>)[盒子相关文档]。默认值:```typc 0%+5pt```。
- *outset*: relative dictionary<square_outset>
在不影响布局的前提下,正方形尺寸可以扩充多少。更多详情请参阅#link(<box_outset>)[盒子相关文档]。默认值:```typc (:)```。
- *body*: none content
放置到方块内的内容。方块会自动扩展以适配该内容,并保持1:1的宽高比。默认值:```typc none```。

若省略此项,方块默认最大尺寸为#rtext[30pt]。

== 描边(stroke)<stroke>
定义如何绘制一条线。

描边包含填充(纯色或渐变)、粗细、线帽、线连接、斜接限制以及虚线样式。所有这些属性值均为可选项,并带有合理的默认值。
=== 示例(Example)
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set line(length: 100%)
#stack(

  spacing: 1em,

  line(stroke: 2pt + red),
  line(stroke: (paint: blue, thickness: 4pt, cap: "round")),
  line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")),
  line(stroke: (paint: blue, thickness: 1pt, dash: ("dot", 2pt, 4pt, 2pt))),
)
    ```
  ],
  [
#set line(length: 100%)
#stack(

  spacing: 1em,

  line(stroke: 2pt + red),
  line(stroke: (paint: blue, thickness: 4pt, cap: "round")),
  line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")),
  line(stroke: 2pt + gradient.linear(..color.map.rainbow)),
)
  ]
)
=== 简单描边(Simple strokes)<stroke_Simple-strokes>
你可以通过颜色、线条粗细,或是两者组合来创建简单的实线描边。具体来说,在需要传入描边参数的位置,你可以传递以下任意一种值:

-- 用于指定描边粗细的长度值。颜色会继承上层设置,默认为黑色。

-- 描边所使用的颜色。粗细会继承上层设置,默认为#rtext[1pt]。

-- 使用加号运算符组合颜色与粗细的描边,例如 #rtext[2pt +] red。

如果需要完全自定义,你也可以向任何需要描边参数的函数传入#link(<dictionary>)[字典]或描边对象。字典的键可以包含构造函数的任意参数,如下所示。
=== 字段(Fields)<stroke_Fields>
在描边对象上,你可以访问构造函数中列出的任意字段。例如,(2pt + blue).thickness 的值为2pt。同时,stroke(red).cap 为自动,因为该属性未指定。设置为自动的字段会继承属性值。
=== 构造函数(Constructor)
将值转换为描边,或使用给定参数构建描边。

请注意,在大多数情况下,你无需手动将值转换为描边即可使用,系统会自动完成转换。不过,该构造函数可用于确保一个值拥有笔触的全部字段。
```typc
stroke(
    paint: auto color gradient tiling,
    thickness:auto length,
    cap: auto str,
    join: auto str,
    dash: none auto str array dictionary,
    miter-limit: auto float,
) → stroke
```
- *paint*: auto color gradient tiling
用于描边的颜色或渐变。

如果设置为#rtext[auto],则该值会继承,默认为黑色。
- *thickness*: auto length
描边粗细。

若设置为自动,该值将继承,默认值为#rtext[1pt]。
- *cap*: auto str
描边端点的渲染方式。

若设置为#rtext[auto],则继承该属性值,默认值为\"butt\"。
#table(

  columns: (0.5fr,2fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"butt\"],[方形描边端点,边线位于描边的终点位置。],
  [\"round\"],[以描边终点为中心的圆形描边端点。],
  [\"square\"],[以描边终点为中心的方形描边端点。],
)
- *join*: auto str
急弯的渲染方式。

若设置为自动,该值将继承,默认值为“miter”。
#table(

  columns: (0.5fr,2fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
  [\"miter\"],[线段以尖角相连。超过斜接限制的急剧弯折将改为斜切处理。],
  [\"round\"],[线段以圆角相连。],
  [\"bevel\"],[线段采用斜切方式连接(用直边对接相连线段的端头)。],
)
- *dash*: none auto str array dictionary\ 要使用的虚线样式。可以是以下类型之一:
  - 下文列出的预定义样式之一。
  - none,等同于预定义样式“solid”(实线)。
  - 由线段与间隔交替长度组成的数组。你也可以使用字符串“dot”代表长度等于线条粗细的点。
  - 包含array(与上面的数组相同)和phase(长度类型)键的字典,phase用于定义从样式的哪个位置开始绘制。
如果设置为#rtext[auto],则该值会继承,默认值为#rtext[none]。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set line(length: 100%, stroke: 2pt)
#stack(

  spacing: 1em,

  line(stroke: (dash: "dashed")),
  line(stroke: (dash: (10pt, 5pt, "dot", 5pt))),
  line(stroke: (dash: (array: (10pt, 5pt, "dot", 5pt), phase: 10pt))),
)
    ```
  ],
  [
#set line(length: 100%, stroke: 2pt)
#stack(

  spacing: 1em,

  line(stroke: (dash: "dashed")),
  line(stroke: (dash: (10pt, 5pt, "dot", 5pt))),
  line(stroke: (dash: (array: (10pt, 5pt, "dot", 5pt), phase: 10pt))),
)
  ]
)
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let patterns = (
  ("dotted", "dashed", "dash-dotted").map(d => (
    "loosely-" + d,
    d,
    "densely-" + d,
  ))
).flatten()

#let display(dash) = {
  set par(spacing: 0.3em)

  show "loosely": set text(eastern.darken(17%))
  show "densely": set text(purple)

  let derived = dash.starts-with("loosely-") or dash.starts-with("densely-")
  if derived { dash } else { strong(dash) }

  rect(
    line(stroke: (dash: dash), length: 100%),
    stroke: none,
    fill: yellow.transparentize(80%),
  )
}

预定义模式的盒子:
#table(

  columns: 3,

  stroke: none,

  align: (left, center, left),

  table.cell(colspan: 3, align: center, display("solid")),
  ..patterns.map(display),
)
    ```
  ],
  [
#let patterns = (
  ("dotted", "dashed", "dash-dotted").map(d => (
    "loosely-" + d,
    d,
    "densely-" + d,
  ))
).flatten()


#let display(dash) = {
  set par(spacing: 0.3em)

  show "loosely": set text(eastern.darken(17%))
  show "densely": set text(purple)

  let derived = dash.starts-with("loosely-") or dash.starts-with("densely-")
  if derived { dash } else { strong(dash) }

  rect(
    line(stroke: (dash: dash), length: 100%),
    stroke: none,
    fill: yellow.transparentize(80%),
  )
}

#table(

  columns: 3,

  stroke: none,

  align: (left, center, left),

  table.cell(colspan: 3, align: center, display("solid")),
  ..patterns.map(display),
)
  ]
)
#table(

  columns: (1fr,1fr),
  stroke: none,
  table.header([*Variant*],[*Details*]),
  table.hline(),
 [\"solid\"],[()],
  [\"dotted\"],[(\"dot\", 2pt)],
  [\"densely-dotted\"],[(\"dot\", 1pt)],
  [\"loosely-dotted\"],[(\"dot\", 4pt)],
  [\"dashed\"],[(3pt, 3pt)],
  [\"densely-dashed\"],[(3pt, 2pt)],
  [\"loosely-dashed\"],[(3pt, 6pt)],
  [\"dash-dotted\"],[(3pt, 2pt, \"dot\", 2pt)],
  [\"densely-dash-dotted\"],[(3pt, 1pt, \"dot\", 1pt)],
  [\"loosely-dash-dotted\"],[(3pt, 4pt, \"dot\", 4pt)],
)
- *miter-limit*: auto float
当突出的锐角弯折使用斜角连接而非斜接连接时对应的数值。数值越大,触发斜角连接前可支持的角度就越锐利。仅当连接方式为“miter(斜接)”时生效。

具体来说,斜接限制是拐角突出长度与描边厚度之间的最大比值。

若设置为#rtext[auto](自动),该值将继承上层属性,默认值为4.0。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let items = (
  curve.move((15pt, 0pt)),
  curve.line((0pt, 30pt)),
  curve.line((30pt, 30pt)),
  curve.line((10pt, 20pt)),
)

#set curve(stroke: 6pt + blue)
#stack(

  dir: ltr,

  spacing: 1cm,

  curve(stroke: (miter-limit: 1), ..items),
  curve(stroke: (miter-limit: 4), ..items),
  curve(stroke: (miter-limit: 5), ..items),
)
    ```
  ],
  [
#let items = (
  curve.move((15pt, 0pt)),
  curve.line((0pt, 30pt)),
  curve.line((30pt, 30pt)),
  curve.line((10pt, 20pt)),
)

#set curve(stroke: 6pt + blue)
#stack(

  dir: ltr,

  spacing: 1cm,

  curve(stroke: (miter-limit: 1), ..items),
  curve(stroke: (miter-limit: 4), ..items),
  curve(stroke: (miter-limit: 5), ..items),
)
  ]
)

== 平铺(tiling)<tiling>
重复平铺填充。

Typst支持最常见的平铺类型,这类平铺会以网格形式重复图案,铺满填充或描边元素的整个区域。图案由一个平铺#link(<tiling_size>)[尺寸]和用于定义每个单元格内容的主体部分构成。你还可以在平铺单元格之间添加水平或垂直#link(<tiling_spacing>)[间距],并调整平铺的起始#link(<tiling_offset>)[偏移位置]。

=== 示例
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let pat = tiling(size: (30pt, 30pt), {
  place(line(start: (0%, 0%), end: (100%, 100%)))
  place(line(start: (0%, 100%), end: (100%, 0%)))
})

#rect(fill: pat, width: 100%, height: 60pt, stroke: 1pt)

    ```
  ],
  [
#let pat = tiling(size: (30pt, 30pt), {
  place(line(start: (0%, 0%), end: (100%, 100%)))
  place(line(start: (0%, 100%), end: (100%, 0%)))
})

#rect(fill: pat, width: 100%, height: 60pt, stroke: 1pt)
  ]
)
=== 文本上的平铺(Tilings on text)
文本同样支持平铺,但仅在将#link(<tiling_relative>)[相对设置]为#rtext()[auto](默认值)或"parent"时生效。如需实现逐词或逐字形平铺,你可以手动将文本中的词语或字符放入方框中,或是通过显示规则完成该操作。
#table(

  columns: (1fr,1fr),
  stroke: none,
  fill: (rgb(250, 250, 250),luma(95%)),
  [
    ```typst
#let pat = tiling(
  size: (30pt, 30pt),
  relative: "parent",
  square(
    size: 30pt,
    fill: gradient
      .conic(..color.map.rainbow),
  )
)

#set text(fill: pat)
#lorem(10)
```
  ],[
#let pat = tiling(
  size: (30pt, 30pt),
  relative: "parent",
  square(
    size: 30pt,
    fill: gradient
      .conic(..color.map.rainbow),
  )
)

#set text(fill: pat)
#lorem(10)
  ]
)
=== 构造函数(Constructor)
构造一个新的平铺。
```typc
tiling(
    size: auto array,
    spacing: array,
    offset: array,
    relative: auto str,
    body: content,
) → tiling
```
- *size*: auto array<tiling_size>
每个平铺单元的边界框,以(x, y)坐标对形式指定。默认值:```typc auto```。

若设置为auto,则平铺区域将采用布局内容的尺寸。
- *spacing*: array<tiling_spacing>
将平铺单元之间的间距指定为(x, y)坐标对。默认值:```typc (0pt,0pt)```。

如果间距小于平铺单元尺寸,平铺图案会发生自重叠。如果间距大于单元尺寸,平铺图案之间会出现空隙。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let pat = tiling(
  size: (30pt, 30pt),
  spacing: (10pt, 20pt),
  square(size: 30pt, fill: gradient.conic(..color.map.rainbow)),
)

#rect(

  width: 100%,

  height: 80pt,

  fill: pat,

  stroke: (thickness: 1pt, dash: "dotted"),
)
    ```
  ],
  [
#let pat = tiling(
  size: (30pt, 30pt),
  spacing: (10pt, 20pt),
  square(size: 30pt, fill: gradient.conic(..color.map.rainbow)),
)

#rect(

  width: 100%,

  height: 80pt,

  fill: pat,

  stroke: (thickness: 1pt, dash: "dotted"),
)
  ]
)
- *offset*: array<tiling_offset>
平移整个瓦片网格,不会改变瓦片大小或间距。默认值:```typc (0%+0pt,0%+0pt)```。

偏移量以(x, y)坐标对设定。x为正值时图案向右移动,y为正值时图案向下移动。相对值会基于瓦片尺寸加上间距进行换算。

请注意,该偏移产生的位移作用于瓦片本身;而内部内容的位移(例如通过place(dx: .., dy: ..)),当内容移动到瓦片边界框外时可能会发生裁切。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#set rect(width: 100%, height: 80pt, stroke: 1pt)

#let pat = tiling(
  size: (20pt, 20pt),
  circle(radius: 10pt, fill: blue),
)

#let pat-with-offset = tiling(
  size: (20pt, 20pt),
  offset: (50%, 50%),
  circle(radius: 10pt, fill: blue),
)

#grid(

  columns: 2,

  column-gutter: 10pt,

  rect(fill: pat),
  rect(fill: pat-with-offset),
)
    ```
  ],
  [
#set rect(width: 100%, height: 80pt, stroke: 1pt)

#let pat = tiling(
  size: (20pt, 20pt),
  circle(radius: 10pt, fill: blue),
)

#let pat-with-offset = tiling(
  size: (20pt, 20pt),
  offset: (50%, 50%),
  circle(radius: 10pt, fill: blue),
)

#grid(

  columns: 2,

  column-gutter: 10pt,

  rect(fill: pat),
  rect(fill: pat-with-offset),
)
  ]
)
- *relative*: auto str<tiling_relative>
确定平铺图案相对于哪个元素的边界框进行绘制。默认值:```typc auto```。

默认情况下,平铺图案相对于其绘制的形状(自身)进行绘制;当平铺应用于文本时除外,此时平铺图案相对于最近的祖先容器(父级)绘制。

元素的父级是包含该元素的最内层框或块;若不存在,则父级为页面本身。
#table(

  columns: 1fr,

  align: left,

  stroke: none,

  fill: (x,y)=>
    if (y==0) {white}
    else if (y==1) {luma(240)}
    ,
  [
    ```typst
#let pat = tiling(
  size: (20pt, 20pt),
  spacing: (5pt, 5pt),
  relative: "self",
  circle(radius: 10pt, fill: teal),
)

#let pat-with-parent = tiling(
  size: (20pt, 20pt),
  spacing: (5pt, 5pt),
  relative: "parent",
  circle(radius: 10pt, fill: teal),
)

#set raw(lang: "typc")
#table(

  columns: (1fr, 1fr, 1fr),
  rows: (auto, 80pt),
  table.header(`"self"`, `"parent"`, `"parent"`),

  // This one is local to the cell itself.
  table.cell(fill: pat, none),

  // These two are both page-relative, so the
  // pattern is continous.
  table.cell(fill: pat-with-parent, none),
  table.cell(fill: pat-with-parent, none),
)
    ```
  ],
  [
#let pat = tiling(
  size: (20pt, 20pt),
  spacing: (5pt, 5pt),
  relative: "self",
  circle(radius: 10pt, fill: teal),
)

#let pat-with-parent = tiling(
  size: (20pt, 20pt),
  spacing: (5pt, 5pt),
  relative: "parent",
  circle(radius: 10pt, fill: teal),
)

#set raw(lang: "typc")
#table(

  columns: (1fr, 1fr, 1fr),
  rows: (auto, 80pt),
  table.header(`"self"`, `"parent"`, `"parent"`),

  // This one is local to the cell itself.
  table.cell(fill: pat, none),

  // These two are both page-relative, so the
  // pattern is continous.
  table.cell(fill: pat-with-parent, none),
  table.cell(fill: pat-with-parent, none),
)
  ]
)
- *body*: content
每个平铺单元的内容。