RGB as resource value

Developer
Size
2,203 Kb
Views
24,288

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 Previews

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);
RGB as resource value - Script Codes
RGB as resource value - Script Codes
Home Page Home
Developer Tom
Username tomprogers
Uploaded September 16, 2022
Rating 3
Size 2,203 Kb
Views 24,288
Do you need developer help for RGB as resource value?

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!

Tom (tomprogers) Script Codes
Create amazing SEO content with AI!

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!