Cool colorful backgrounds, generated by JS
npm install color4bgInstall color4bg via npm:
``bash`
npm install color4bg
Or via yarn:
`bash`
yarn add color4bg
Or via pnpm:
`bash`
pnpm add color4bg
> For example, if you want to add Aesthetic Fluid Bg:
1. Import the AestheticFluidBg class from the package:
`javascript`
import { AestheticFluidBg } from "color4bg"
2. Create an instance of AestheticFluidBg with your customized settings:
`javascript
let colorbg = new AestheticFluidBg({
dom: "box",
colors: ["#D1ADFF", "#98D69B", "#FAE390", "#FFACD8", "#7DD5FF", "#D1ADFF"],
seed: 1000,
loop: true
})
// Don't forget to start the animation
colorbg.start()
`
You can import any of the following background classes:
`javascript`
import {
AbstractShapeBg,
AestheticFluidBg,
AmbientLightBg,
BigBlobBg,
BlurDotBg,
BlurGradientBg,
ChaosWavesBg,
CurveGradientBg,
GridArrayBg,
RandomCubesBg,
StepGradientBg,
SwirlingCurvesBg,
TrianglesMosaicBg,
WavyWavesBg,
ColorBg // Base class
} from "color4bg"
| Key | Value | Describe |
| :-------- | :------- | :-------------------------------- |
| dom | string | Id of DOM element where to append colorbg, no need to add "#" |colors
| | Array | An array of up to 6 hexadecimal color values |seed
| | Number | A Pseudo-random numerical value used to generate a consistent pattern. |loop
| | Bool` | Determines whether the background should animated looply or not |
#### For more usage, see examples