winterx / color4bg.js

Cool colorful backgrounds, generated by JS
552 stars 37 forks source link

color4bg.js

color4bg.js MIT License

Super easily generate dynamic, abstract, and visually stunning background images for your web pages based on WebGL and JavaScript. High performance.

Demo

Please visit: color4bg.com

color4bg.js

šŸš€ Features

šŸ“¦ Usage

To use color4bg.js, follow these steps:

For example, if you want to add Aesthetic Fluid Bg:

  1. Import the AestheticFluidBg module js file:

    import { AestheticFluidBg } from "../build/jsm/AestheticFluidBg.module.js"
  2. Create an instance of AestheticFluidBg with your customized settings:

    let colorbg = new AestheticFluidBg({
    dom: "box",
    colors: ["#D1ADFF", "#98D69B", "#FAE390", "#FFACD8", "#7DD5FF", "#D1ADFF"],
    seed: 1000,
    loop: true
    })
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

All Background(Bg) Types

All bg

License

This project is licensed under the MIT License.