Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@visx/gradient

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/gradient

visx gradient

  • 3.12.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
184K
decreased by-19.25%
Maintainers
4
Weekly downloads
 
Created

What is @visx/gradient?

@visx/gradient is a part of the VisX library, which provides a collection of reusable low-level visualization components for React. The @visx/gradient package specifically focuses on creating gradient definitions that can be used in SVG elements to enhance visualizations with gradient effects.

What are @visx/gradient's main functionalities?

Linear Gradient

This feature allows you to create a linear gradient that transitions between two colors. The example demonstrates how to apply a linear gradient to a rectangle in an SVG element.

import { LinearGradient } from '@visx/gradient';

const LinearGradientExample = () => (
  <svg width={500} height={500}>
    <LinearGradient id="linear" from="#fbc2eb" to="#a6c1ee" />
    <rect x={0} y={0} width={500} height={500} fill="url(#linear)" />
  </svg>
);

Radial Gradient

This feature allows you to create a radial gradient that transitions between two colors from the center outwards. The example demonstrates how to apply a radial gradient to a rectangle in an SVG element.

import { RadialGradient } from '@visx/gradient';

const RadialGradientExample = () => (
  <svg width={500} height={500}>
    <RadialGradient id="radial" from="#fbc2eb" to="#a6c1ee" />
    <rect x={0} y={0} width={500} height={500} fill="url(#radial)" />
  </svg>
);

Custom Gradient Stops

This feature allows you to define custom gradient stops within a linear gradient. The example demonstrates how to create a gradient with multiple color stops and apply it to a rectangle in an SVG element.

import { LinearGradient } from '@visx/gradient';

const CustomGradientStopsExample = () => (
  <svg width={500} height={500}>
    <LinearGradient id="custom" from="#fbc2eb" to="#a6c1ee">
      <stop offset="0%" stopColor="#fbc2eb" />
      <stop offset="50%" stopColor="#a6c1ee" />
      <stop offset="100%" stopColor="#fbc2eb" />
    </LinearGradient>
    <rect x={0} y={0} width={500} height={500} fill="url(#custom)" />
  </svg>
);

Other packages similar to @visx/gradient

Keywords

FAQs

Package last updated on 07 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc