RGB as resource value
How do I make an rgb as resource value?
Experiment with representing numeric value as color. What is a rgb as resource value? How do you make a rgb as resource value? This script and codes were developed by Tom on 16 September 2022, Friday.
RGB as resource value - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>RGB as resource value</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="out"></div> <script src="js/index.js"></script>
</body>
</html>
RGB as resource value - Script Codes CSS Codes
body { background: #333333; color: gold; font-size: 19px; font-family: monospace;
}
RGB as resource value - Script Codes JS Codes
function write(s) { document.getElementById('out').innerHTML += s;
}
function getV(hex, colorAbbrev) { var dec = parseInt(hex, 16); var factor = ({r: 1, g: 4, b: 9})[colorAbbrev]; return ((factor * (dec/255)) / 14);
}
function rgbToCash(rgb) { if(!/#([0-9a-f]{6})/.test(rgb)) throw 'Invalid hex color'; return ( getV(rgb.substr(1,2), 'r') + getV(rgb.substr(3,2), 'g') + getV(rgb.substr(5,2), 'b') );
}
var map = [ ['#800d1e', '#fe5000', '#ffffff'], ['#ff0000', '#00ff00', '#0000ff']
];
// x,y are rooted at top-left and proceed in reading order
var out = '<table>';
map.forEach(function(row) { out += '<tr>'; row.forEach(function(cellColor) { out += '<td style="background:' + cellColor + '">'; out += rgbToCash(cellColor); out += '</td>'; }); out += '</tr>';
});
out += '</table>';
write(out);
console.log(document.getElementById('out').innerHTML);
Developer | Tom |
Username | tomprogers |
Uploaded | September 16, 2022 |
Rating | 3 |
Size | 2,203 Kb |
Views | 24,288 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Storage visualization | 4,014 Kb |
Demo of some course-list filtering | 9,852 Kb |
Static doc search | 5,255 Kb |
Layout for wordsearch tutorial | 2,726 Kb |
Playing with auto-truncation of text | 2,217 Kb |
CSS3 glowing LEDs | 2,166 Kb |
Layout for crafting assistant | 3,522 Kb |
Algo work | 2,486 Kb |
Gravatar monogram playground | 3,235 Kb |
Dark theme search box | 2,187 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Greyscale image with filter in CSS3 | NickyCDK | 1,562 Kb |
Improve | Gavra | 1,652 Kb |
Animated bar chart | CreativePunch | 3,124 Kb |
STAR WARS LIGHTSABER | Francoiscoron | 4,420 Kb |
Box-sizing | Elad2412 | 1,572 Kb |
The Monty Hall Problem | Melatonind | 4,360 Kb |
Scarlett Johansson Tribute Page | Diomed | 3,233 Kb |
Project MMetro beta | Atomicsong | 5,157 Kb |
Blog demo to use given styling | Andygirl | 2,412 Kb |
Underlined form fields | Mitchdot | 2,323 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!