Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
CSS doesn't natively support color blending the way that Photoshop does. This library attempts to fake that by allowing you to blend a foreground color with a background color in order to approximate color blending. This not a dynamic blend; you can't use this to blend a color with an image. This was originally intended for use with the Compass Photoshop Drop Shadow Plugin but it proved impractical to integrate.
Adobe has been working on a W3C spec to add blend modes to CSS3. However, this has not been implemented in any browser. This library is not a polyfill for those blend modes. A polyfill for real, dynamic blend modes will require SVG or JavaScript + Canvas.
The included functions are based on blend.js from the Pixastic Image Processing Library. I chose this library because JavaScript is easy enough to read and the blend modes seemed to match closely with what Photoshop offered. Additionally, a detailed explaination of Photoshop blend modes was used as a reference as well as the Wikipedia article on blend modes.
These blend mode functions are not magic. In Photoshop, the blend mode functions are applied dynamically between two layers in order to create a pixel-by-pixel blend. In CSS they can only be used to combine two solid colors together. Blend modes can be useful in times when a Photoshop design implements a blend mode on an element, like a drop shadow, that is over a mostly solid background. Choosing a dominant background color and a solid foreground color may allow for the apearance of a dynamically blended color.
gem install compass-blend-modes
You can include it in any existing Compass project by including the plugin in your config.rb file.
# Require any additional compass plugins here.
require 'compass-blend-modes'
You can install the plugin as part of a new Compass project.
compass create my_project -r compass-blend-modes
@import 'blend-modes';
// make sure the functions are imported
@import 'blend-modes';
// Solid background
.multiply {
background-color: blend-multiply(#7FFFD4, #DEB887);
}
// RGBa background
.multiply {
background-color: blend-multiply(rgba(#7FFFD4, 0.5), rgba(#DEB887, 0.5));
}
All functions expect a color as the $foreground
and $background
colors. The colors can be any hex, rgb, rgba, hsl, or hsla color supported by Sass. Blending functions work by combining the colors from the top-most layer, the $foreground
, with the lower layer, the $background
.
These functions are used to convert between RGB, HSL and HSV color formats. The HSV color format is not natively supported by CSS or Sass. These functions were taken directly from this Gist. HSV values are used to calculate the results for the blend-colorblend
, blend-hue
, blend-luminosity
and blend-saturation
functions.
$h
can be a list of three values representing $h
, $s
and $v
.$h
can be a list of three values representing $h
, $ss
and $ll
.$h
can be a list of three values representing $h
, $s
and $v
These functions are used to save redundant code and are not meant to be used directly. These functions perform the blending operation on a single r, g or b value.
NOTE: These functions are not intended to be used directly.
FAQs
Unknown package
We found that compass-blend-modes 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.