Skip to content

Commit 358efd7

Browse files
committed
build: updated docs
1 parent 1dae726 commit 358efd7

4 files changed

Lines changed: 66 additions & 0 deletions

File tree

engine/src/Options/Interfaces/Particles/IParticlesOptions.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export interface IParticlesOptions {
5555
*/
5656
opacity: IOpacity;
5757

58+
/**
59+
* Registered palette id to import particle fill/stroke/blend defaults
60+
*/
5861
palette?: string;
5962

6063
/**

markdown/Options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Use it to choose where to start, then jump to the detailed guides for each optio
100100
- [Group](./Options/Particles/Group.md)
101101
- [Life](./Options/Particles/Life.md)
102102
- [Orbit](./Options/Particles/Orbit.md)
103+
- [Palette](./Options/Particles/Palette.md)
103104
- [Repulse](./Options/Particles/Repulse.md)
104105
- [Roll](./Options/Particles/Roll.md)
105106
- [Rotate](./Options/Particles/Rotate.md)

markdown/Options/Particles.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Use the links below to navigate to the detailed page for each sub-option.
2020
| `number` | How many particles exist and density rules | [Number](./Particles/Number.md) |
2121
| `opacity` | Transparency and animated fading | [Opacity](./Particles/Opacity.md) |
2222
| `orbit` | Orbital rotation around a center point | {@link IOrbit} |
23+
| `palette` | Imports a named palette and applies fill/stroke + blend defaults | [Palette](./Particles/Palette.md) |
2324
| `reduceDuplicates` | When `true`, picks particle configs sequentially instead of randomly ||
2425
| `repulse` | Mutual repulsion between particles | {@link IParticlesRepulse} |
2526
| `roll` | 3D-like rolling effect | [Roll](./Particles/Roll.md) |
@@ -95,6 +96,30 @@ Particle groups let you define subsets of particles with different configs appli
9596
}
9697
```
9798

99+
## palette
100+
101+
`particles.palette` loads a registered palette by id and automatically applies particle colors.
102+
103+
When a palette is found, tsParticles imports these defaults:
104+
105+
- `fill`: enabled/disabled according to palette settings
106+
- `fill.color.value`: palette color list when fill mode is enabled
107+
- `stroke`: one stroke per palette color when fill mode is disabled
108+
- `blend`: enabled with the palette blend mode
109+
110+
```json
111+
{
112+
"particles": {
113+
"palette": "ocean",
114+
"shape": {
115+
"type": "circle"
116+
}
117+
}
118+
}
119+
```
120+
121+
If you set `fill`, `stroke`, or `blend` explicitly after `palette`, those values override imported defaults.
122+
98123
## reduceDuplicates
99124

100125
When `true`, particles cycle through configs sequentially instead of picking randomly — useful for guaranteed even distribution.
@@ -112,4 +137,5 @@ When `true`, particles cycle through configs sequentially instead of picking ran
112137
- Number: [Number](./Particles/Number.md)
113138
- Move: [Move](./Particles/Move.md)
114139
- Links: [Links](./Particles/Links.md)
140+
- Palette: [Palette](./Particles/Palette.md)
115141
- Shape: [Shape](./Particles/Shape.md)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Particles Palette
2+
3+
Use `particles.palette` to import a named palette and quickly assign consistent colors.
4+
5+
## Type
6+
7+
- `string` (palette id)
8+
9+
## What it configures
10+
11+
When a matching palette is registered, the engine imports particle defaults:
12+
13+
- `fill.enable`: copied from the palette settings
14+
- `fill.color.value`: set to palette colors when fill is enabled
15+
- `stroke`: generated from palette colors when fill is disabled
16+
- `blend.enable`: set to `true`
17+
- `blend.mode`: copied from palette blend mode
18+
19+
## Example
20+
21+
```json
22+
{
23+
"particles": {
24+
"palette": "sunset",
25+
"shape": {
26+
"type": "circle"
27+
}
28+
}
29+
}
30+
```
31+
32+
## Precedence notes
33+
34+
- If `particles.palette` points to an unknown id, no palette import is applied.
35+
- Explicit values for `particles.fill`, `particles.stroke`, or `particles.blend` override imported palette defaults.
36+
- `particles.palette` affects only particle-level style options; it does not replace root-level `preset` loading.

0 commit comments

Comments
 (0)