Subtractive Color Mixing With jQuery - Color Mixer

Subtractive Color Mixing With jQuery - Color Mixer
File Size: 4.16 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Color Mixer is a JavaScript (jQuery) color manipulation plugin for subtractive color mixing that mixes two provided colors together to create a third color.

How to use it:

1. Include the required jQuery library and jQuery color plugin on the page.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-color/2.1.2/jquery.color.min.js" 
        integrity="sha384-Dmia8eQq5QAVU5VL95mpXzGE2n2oYxIv9aFwn+JAtQ3Y/4bWeHSjKUgYSJi/BovQ" 
        crossorigin="anonymous">
</script>

2. Download and include the Color Mixer plugin's script after jQuery.

<script src="color_mixer.js"></script>

3. Set alpha values for colors.

color1 = '#F5FF00'
color1 = color1.alpha(1);

color2 = '#00C2FF'
color2 = color2.alpha(.5);

4. The JavaScript to mix these two color together.

color = Color_mixer.mix(color1,color2);

This awesome jQuery plugin is developed by AndreasSoiron. For more Advanced Usages, please check the demo page or visit the official website.