Interactive background color

Set CSS for background, text and and hovering color.

Preview


Violet
Blue Green

Module & Import


js

import { bgColorInt } from 'gadjet/dist/module/style/bg-color-int.js';

Function signature


bgColorInt({
    color?: string = 'blue',
    lighten?: number = 0.2, // Can be -1 to 1
    saturate?: number = 0.2 // Can be -1 to 1
}) => string;

param color?: string = 'blue'

CSS color for background.

param lighten?: number = 0.2

Lighten level of background when hovering, range [-1, 1]

param saturate?: number = 0.2

Saturation level of background when hovering, range [-1, 1]

return

CSS string

Usage


js

import { addStyle, bgColorInt } from 'gadjet';

addStyle`
div {
    ${bgColorInt({
        color: 'blue',
        lighten: 0.2,
        saturate: 0.2
    })} 
}`;
gadjet
Getting Started Style Portion UI