New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cssvartransition

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssvartransition

RGB transitions for CSS Variables

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

CSSVarTransition

RGB transitions for CSS Variables

Install

> Terminal
npm install --save cssvartransition

Function

async function transitionRGB(variable, target, seconds = 1000, steps = 10)

variable:

  • String (Required),
  • name of root CSS Variable.

target:

  • List of integers (Required),
  • [red, green, blue] between 0 - 255.

duration:

  • Integer,
  • milliseconds i.e. 3000 = 3 seconds,
  • defaults to 1000.

steps:

  • Integer,
  • number of times the variable is updated during transition,
  • ( i.e. 5) lower = more accurate transition, higher ( i.e. 20 ) is smoother,
  • defaults to 10.

Use example

<!-- /index.html -->

<p>Hello World</p>
/* /Style.css */

:root {
  --color-1: 176, 5, 192;
  }
  
 p {
  background-color: rgb( var(--color-1) );
 }
# /main.js
 
import transitionRGB from "cssvartransition";

await transitionRGB( '--color-1', [ 210, 52, 243 ] );

Keywords

js

FAQs

Package last updated on 10 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts