Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Tiny script smoothly cycles between many background and/or text colors on any element
Smoothly cycle between many background and/or text colors on any element. Around 550 bytes minified & gzipped with no library / framework dependencies. Inspired by the header effect at clrs.cc.
Note: the original jQuery plugin is still available (dist/colorflow.jquery.js). Instructions for that are at the bottom, but there's really no reason to use it at this point.
Install via npm or add a script from the dist directory to your page.
npm install colorflow
var ColorFlow = require('colorflow');
Or with a script tag:
<script src="colorflow.js"></script>
var colorflow1 = new ColorFlow({
element: ['body'],
background: ['#85144b', '#F012BE', '#FFBC00', '#7FDBFF', '#01FF70'],
text: ['#CF5D94', '#EFA9FA', '#665800', '#004966', '#00662C'],
time: 25
});
You may include multiple tags or basic css element selectors -- for example ['.class', '#id', 'div']
--in the element
array. time
and at least one of background
or text
is also required.
The effect is CSS-based and colors can be provided in any regular CSS format. They will be displayed in the order given before looping back to the first color after the specified amount of time (number of seconds). If you use background and text in the same object, the colors of each index are tied together. If one array is shorter, the last color will just take longer to transition into the first as the other finishes.
Examples below using the instance created above.
> colorflow1.element
["body"]
> colorflow1.background
["#85144b", "#F012BE", "#FFBC00", "#7FDBFF", "#01FF70"]
> colorflow1.text
["#CF5D94", "#EFA9FA", "#665800", "#004966", "#00662C"]
> colorflow1.time
25
> colorflow1.thisClass // returns the currently active (or last active) colorflow class
"colorflow-ituaxyldi"
Restart with the flow
method.
> colorflow1.element.push('.example-class')
["body", ".example-class"]
> colorflow1.background.push('#000')
> colorflow1.text.push('#fff')
> colorflow1.time = 30
// new options are set. instead of appending, you can also set a new array using, for example, colorflow1.text = ['#000', '#fff']
> colorflow1.flow() // restarts the colorflow instance with the new variables - in this case, the revised effect will also be applied to example-class.
> colorflow1.thisClass // a new class containing the animation info has been created and applied to the elements
"colorflow-llxfuwtmkji"
colorflow1.disable();
This will remove all colorflow classes from the elements in the element array, reverting them to their default color state. The colorflow1
object will still exist and the flow method will wake it up. Or simply add the disabled class, still stored in colorflow1.thisClass
, back to the element.
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="js/colorflow.jquery.js"></script>
$("body").colorFlow({
background: ['#85144b', '#F012BE', '#FFBC00', '#7FDBFF', '#01FF70'],
text: ['#CF5D94', '#EFA9FA', '#665800', '#004966', '#00662C'],
time: 25
});
$("body").colorFlow("destroy");
License: MIT
FAQs
Tiny script smoothly cycles between many background and/or text colors on any element
The npm package colorflow receives a total of 2 weekly downloads. As such, colorflow popularity was classified as not popular.
We found that colorflow 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.