Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The lightness or darkness of a color is called its value. Tints are light values that are made by mixing a color with white, which increases lightness. Shades are dark values that are made by mixing a color with black, which reduces lightness.
http://noeldelgado.github.io/Values.js/
npm install values.js
bower install values.js
// node
var Values = require('Values.js');
// browser
<script src="path-to-values/index.js"></script>
var color = new Values('#0099ff');
console.log(color.hex) // => "0099ff"
console.log(color.rgb) // => {r:0, g:153, b:255}
console.log(color.hsl) // => {h:204, s: 100, l: 50}
console.log(color.hexString()) // => "#0099ff"
console.log(color.rgbString()) // => "rgb(0, 153, 255)"
console.log(color.hslString()) // => "hsl(204, 100%, 50%)"
console.log(color.getBrightness()) // => 53
color.tints().forEach(function(tint) {
console.log(tint); // => [Value instance]
});
color.shades().forEach(function(shade) {
console.log(shade); // => [Value instance]
});
// tints, original color and shades
color.all().forEach(function(color) {
console.log(color); // => [Value instance]
});
/**
Sets the base color for which all operations are based. Updates the instance's properties.
@method setColor <public> [Function]
@param color <required> [String] A valid color format (#000, rgb(0,0,0), hsl(0,0%,0%))
@return Values instance || Error [Object]
*/
color.setColor('ff0');
color.setColor('rgb(255,255,0)');
color.setColor('hsl(60,100%,50%)');
/**
Lightens the instance by mixing it with white as specified by @percentage.
@method tint <public> [Function]
@param percentage <optional> [Number] {50}
@return new Values instance [Object]
*/
color.tint();
color.tint(10);
color.tint(24);
/**
Darkens the instance color by mixing it with black as specified by @percentage.
@method shade <public> [Function]
@param percentage <optional> [Number] {50}
@return new Values instance [Object]
*/
color.shade();
color.shade(9);
color.shade(31);
/**
Generates the tints of the instance color as specified by @percentage.
@method tints <public> [Function]
@param percentage <optional> [Number] {10}
@return Array of Values instances [Array]
*/
color.tints(20).forEach(function(tint) {
console.log(tint)
})
/**
Generates the shades of the instance color as specified by @percentage.
@method shades <public> [Function]
@param percentage <optional> [Number] {10}
@return Array of Values instances [Array]
*/
color.shades(20).forEach(function(shade) {
console.log(shade)
})
/**
Generates the tints and shades of the instance color as specified by @percentage.
@method all <public> [Function]
@param percentage <optional> [Number] {10}
@return Array of Values instances [Array]
*/
color.all().forEach(function(color) {
console.log(color)
})
Values.Utils.isHEX('09c') => true
Values.Utils.isHEX('#09c') => true
Values.Utils.isHEX('#0099cc') => true
Values.Utils.isHEX('09cc') => false
Values.Utils.isRGB('rgb(0,0,0)') => true
Values.Utils.isRGB('rgba(0,0,0,.0)') => true
Values.Utils.isRGB('0,0,0') => false
Values.Utils.isHSL('hsl(198,58%,1%)') => true
Values.Utils.isHSL('hsla(360,10%,10%, 1)') => true
Values.Utils.isHSl('hsl(361,10%,10%)') => false
FAQs
Get tints and shades of a CSS color
We found that values.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.