Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
bootstrap-colorpicker
Advanced tools
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4.
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4.
You can get the latest version in many different ways:
git clone https://github.com/itsjavi/bootstrap-colorpicker.git
npm install bootstrap-colorpicker
yarn add bootstrap-colorpicker
composer require itsjavi/bootstrap-colorpicker
Note that the dist
files are only distributed via the NPM and Yarn installations.
For the rest methods, you will need to generate the files initializing the project with yarn install
and then building the code using npm run build
.
Colorpicker version | Compatible Bootstrap version | Dependencies |
---|---|---|
v2.x Documentation | Bootstrap 3 or 4 |
|
v3.x Documentation | Bootstrap 4 or without Bootstrap |
|
Note that the plugin may work without Bootstrap if your code is not using any of the mentioned Bootstrap dependencies.
The Bootstrap JS dependency is optional and it is mainly needed for the popover support. No Bootstrap CSS is required for the plugin to work.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="dist/css/bootstrap-colorpicker.css" rel="stylesheet">
</head>
<body>
<div class="demo">
<h1>Bootstrap Colorpicker Demo (with Bootstrap)</h1>
<input id="demo-input" type="text" value="rgb(255, 128, 0)" />
</div>
<script src="//code.jquery.com/jquery-3.4.1.js"></script>
<script src="//unpkg.com/bootstrap@4.3.1/dist/js/bootstrap.bundle.min.js"></script>
<script src="dist/js/bootstrap-colorpicker.js"></script>
<script>
$(function () {
// Basic instantiation:
$('#demo-input').colorpicker();
// Example using an event, to change the color of the #demo div background:
$('#demo-input').on('colorpickerChange', function(event) {
$('#demo').css('background-color', event.color.toString());
});
});
</script>
</body>
To use the plugin without Bootstrap, the popover
option should be set to false
or null
and, depending on your implementation,
you will usually need to set inline to true
and a container
selector option.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="dist/css/bootstrap-colorpicker.css" rel="stylesheet">
</head>
<body>
<div id="demo">
<h1>Bootstrap Colorpicker Demo (without Bootstrap)</h1>
<input type="text" value="rgb(255, 128, 0)" />
</div>
<script src="//code.jquery.com/jquery-3.4.1.js"></script>
<script src="dist/js/bootstrap-colorpicker.js"></script>
<script>
$(function() {
$('#demo').colorpicker({
popover: false,
inline: true,
container: '#demo'
});
});
</script>
</body>
This project exists thanks to all the people who contribute.
Please read CONTRIBUTING before sending a pull request or issue.
The MIT License (MIT). Please see the License File for more information.
Written and maintained by Javi Aguilar and all other contributors.
Based on Stefan Petre's color picker (2013).
Thanks to JetBrains for supporting this project.
FAQs
Bootstrap Colorpicker is a modular color picker plugin for Bootstrap 4.
The npm package bootstrap-colorpicker receives a total of 58,304 weekly downloads. As such, bootstrap-colorpicker popularity was classified as popular.
We found that bootstrap-colorpicker 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
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.