From 8dc047510824654cd236357b2eaedd21c06e96d1 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 26 May 2023 11:55:08 +0200 Subject: contrib/logo-color: support settings the background --- contrib/logo-color.d/script.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'contrib/logo-color.d') diff --git a/contrib/logo-color.d/script.js b/contrib/logo-color.d/script.js index ac89905..82cc204 100644 --- a/contrib/logo-color.d/script.js +++ b/contrib/logo-color.d/script.js @@ -1,5 +1,12 @@ +function invertHex(hex) { + return (Number("0x1" + hex) ^ 0xffffff).toString(16).substr(1); +} + function color() { var svg = document.querySelector(".logo").getSVGDocument(); svg.getElementById("dark-1").setAttribute("stop-color", document.getElementById("color1").value); svg.getElementById("dark-2").setAttribute("stop-color", document.getElementById("color2").value); + var background = document.getElementById("color3").value; + svg.getElementById("background").setAttribute("fill", background); + svg.getElementById("hexagon").setAttribute("stroke", "#" + invertHex(background.substring(1))); } -- cgit v1.2.3-54-g00ecf