Socket
Socket
Sign inDemoInstall

onecolor

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onecolor

Javascript color object with implicit color space conversions. Supports RGB, HSV, HSL and CMYK with alpha channel.


Version published
Maintainers
2
Created

What is onecolor?

The onecolor npm package is a versatile color manipulation library that allows you to work with colors in various formats, convert between them, and perform operations like blending and adjusting color properties.

What are onecolor's main functionalities?

Color Creation

You can create a color object from a string representing a color in various formats (hex, RGB, HSL, etc.). The created color object can then be used for further manipulations.

const onecolor = require('onecolor');
const color = onecolor('#3498db');
console.log(color.css()); // Outputs: 'rgb(52, 152, 219)'

Color Conversion

The package allows you to convert colors between different formats such as HEX, RGB, and HSL.

const onecolor = require('onecolor');
const color = onecolor('#3498db');
console.log(color.hex()); // Outputs: '#3498db'
console.log(color.rgb()); // Outputs: 'rgb(52, 152, 219)'
console.log(color.hsl()); // Outputs: 'hsl(204, 0.68, 0.53)'

Color Manipulation

You can manipulate color properties like lightness, saturation, and hue. This example demonstrates adjusting the lightness of a color.

const onecolor = require('onecolor');
const color = onecolor('#3498db').lightness(0.5);
console.log(color.css()); // Outputs: 'rgb(26, 76, 109)'

Color Blending

The package supports blending two colors together. This example shows how to blend two colors with equal weight.

const onecolor = require('onecolor');
const color1 = onecolor('#3498db');
const color2 = onecolor('#e74c3c');
const blendedColor = color1.mix(color2, 0.5);
console.log(blendedColor.css()); // Outputs: 'rgb(153, 101, 123)'

Other packages similar to onecolor

Keywords

FAQs

Package last updated on 30 May 2016

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