File:Tinctured CoA.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 102 × 132 pixels, file size: 142 bytes)

Captions

Captions

Add a one-line explanation of what this file represents

Summary[edit]

Description
English: Example for an SVG varied by a contained script
Note: Uploading such SVG is abolished - you may perform the code with your browser
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="102" height="132">
<script>
window.addEventListener("DOMContentLoaded", () => 
{	function getColor()
	{	const R = Math.round(Math.random() * 255)
		.toString(16)
		.padStart(2, "0");

		const G = Math.round(Math.random() * 255)
		.toString(16)
		.padStart(2, "0");

		const B = Math.round(Math.random() * 255)
		.toString(16)
		.padStart(2, "0");

        return `#${R}${G}${B}`;
	}

	document.querySelector("path").addEventListener("click", (e) =>
	{ e.target.style.fill = getColor();
	});
});
</script>

<path fill="#FCF" d="m1,65 50,65 50-65-50-65"/>
</svg>
Date
Source Own work using: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/script
Author Sarangbot
Permission
(Reusing this file)
Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
SVG development
InfoField
 
The SVG code is valid.
 
This vector image was created with a text editor.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current10:07, 6 March 2023Thumbnail for version as of 10:07, 6 March 2023102 × 132 (142 bytes)Sarangbot (talk | contribs)== {{int:filedesc}} == {{Inform | dese = Example for an SVG varied by a '''contained script''' :'''Note:''' Uploading such SVG is abolished - you may perform the code with your browser <syntaxhighlight lang="html"> <?xml version="1.0"?> <svg xmlns="http://www.w3.org/2000/svg" width="102" height="132"> <script> window.addEventListener("DOMContentLoaded", () => { function getColor() { const R = Math.round(Math.random() * 255) .toString(16) .padStart(2, "0"); const G = Math.round(Math.r...

There are no pages that use this file.

Metadata