Example:
Parses hexadecimal value to get RGB color values.
var hex = 'ffaadd';
var rgb = parseInt(hex, 16); // rgb is 16755421
var red = (rgb >> 16) & 0xFF; // returns 255
var green = (rgb >> 8) & 0xFF; // 170
var blue = rgb & 0xFF; // 221
More Related Contents:
- What are bitwise operators?
- What’s the difference between & and && in JavaScript?
- How does !!~ (not not tilde/bang bang tilde) alter the result of a ‘contains/included’ Array method call?
- Why does a shift by 0 truncate the decimal?
- How does !!~ (not not tilde/bang bang tilde) alter the result of a ‘contains/included’ Array method call?
- Why are JavaScript negative numbers not always true or false?
- Adding one decimal place in javaScript
- language for creating contract template [closed]
- How to translate a ‘greeting_for’ function from Ruby to Javascript [closed]
- What is the difference between a function call and function reference?
- Detect IE version (prior to v9) in JavaScript
- Verify if a point is Land or Water in Google Maps
- Detect iFrame embedding in Javascript
- Copy to Clipboard in Chrome Extension
- Python while loop conversion to Javascript [duplicate]
- How to create an instance of a subclass from the super class?
- Why “$().ready(handler)” is not recommended?
- Could not complete the operation due to error 80020101. IE [duplicate]
- How can I use JSON data to populate the options of a select box?
- how to set DOM Breakpoints in chrome
- Alert for unsaved changes in form
- Cannot load Deezer API resources from localhost with the Fetch API
- Firebase search by child value
- CSS transitions do not work when assigned trough JavaScript
- Randomize setInterval ( How to rewrite same random after random interval)
- ES6 module scope
- Using Longitude/Latitude as Waypoint
- Error when checking input: expected dense_Dense1_input to have x dimension(s). but got array with shape y,z
- Communicate between two pages / tabs
- Disabling links to stop double-clicks in JQuery