<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Adding background image to analog clock.]]></title><description><![CDATA[<p dir="auto">Hello, I’m trying to add a svg image to the default analog clock module in a way that will allow me to change it’s color along with the other elements using custom.css.</p>
<p dir="auto">However the problem is the image hides part of the clock hands and I can’t figure how to fix it. Any suggestions?</p>
<p dir="auto">Here’s my entry in the custom.css file:</p>
<pre><code>.clock-face {
.clock-face {
  -webkit-mask: url('apple-fresh-fruit-svgrepo-com.svg') center/cover no-repeat;
  mask: url('apple-fresh-fruit-svgrepo-com.svg');
  display: block;
  margin: auto;
  margin-top: 60px;
  height:45%;
  width: 45%;
  background:var(--use_color);
}
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1731377692363-20241111_18h07m53s_grim.png" alt="20241111_18h07m53s_grim.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/topic/19128/adding-background-image-to-analog-clock</link><generator>RSS for Node</generator><lastBuildDate>Sun, 10 May 2026 11:19:07 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/19128.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Nov 2024 02:17:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 03:53:32 GMT]]></title><description><![CDATA[<p dir="auto">I found a way to make this work, though it’s not the cleanest.</p>
<p dir="auto">1:<br />
In the clock.js file I add these lines to the bottom of these sections:</p>
<pre><code>/************************************
* Create wrappers for analog and digital clock
*/
const analogBackground = document.createElement("div");
analogBackground.className = "clock-grid-background";
</code></pre>
<pre><code>/****************************************************************
* Create wrappers for ANALOG clock, only if specified in config
*/
clockFace.appendChild(analogBackground);
</code></pre>
<p dir="auto">2:<br />
Added this section to the clock_styles.css:<br />
Note the “z-index: 0;”</p>
<pre><code>.clock-grid-background {
  position: absolute;
  display: block;
  z-index: 0;
}
</code></pre>
<p dir="auto">I then added “z-index: 99;” to the following sections to make sure they stay on top:<br />
.clock-circle<br />
.clock-face<br />
.clock-face::after<br />
.clock-hour<br />
.clock-minute<br />
.clock-second</p>
<ol start="3">
<li></li>
</ol>
<p dir="auto">Added this code to the custom.css file:</p>
<pre><code>.clock-grid-background {
  -webkit-mask: url('apple-fresh-fruit-svgrepo-com.svg') center/cover no-repeat;
  //mask: url('apple-fresh-fruit-svgrepo-com.svg');
  display: block;
  margin: auto;
  margin-top: 60px;
  margin-left: 65px;
  height: 120px;
  width: 120px;
  background-color: var(--use_color);
}
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/121249</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121249</guid><dc:creator><![CDATA[ChrisLeduex]]></dc:creator><pubDate>Wed, 13 Nov 2024 03:53:32 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 20 Nov 2024 01:09:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisleduex" aria-label="Profile: ChrisLeduex">@<bdi>ChrisLeduex</bdi></a> – OK, thanks. I wasn’t sure that the url path went anywhere in particular.</p>
]]></description><link>https://forum.magicmirror.builders/post/121467</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121467</guid><dc:creator><![CDATA[JohnGalt]]></dc:creator><pubDate>Wed, 20 Nov 2024 01:09:36 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Tue, 19 Nov 2024 21:20:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/johngalt" aria-label="Profile: JohnGalt">@<bdi>JohnGalt</bdi></a> I just put them directly in the CSS folder with the custom.css file while I was testing everything. But they can certainly go wherever you like based on how you organize stuff.</p>
]]></description><link>https://forum.magicmirror.builders/post/121458</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121458</guid><dc:creator><![CDATA[ChrisLeduex]]></dc:creator><pubDate>Tue, 19 Nov 2024 21:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Mon, 18 Nov 2024 21:11:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisleduex" aria-label="Profile: ChrisLeduex">@<bdi>ChrisLeduex</bdi></a> – Interesting exercise. Where did you put the .svg image[s]? In with the clock faces in the module folder? In the module folder root? Other?</p>
]]></description><link>https://forum.magicmirror.builders/post/121410</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121410</guid><dc:creator><![CDATA[JohnGalt]]></dc:creator><pubDate>Mon, 18 Nov 2024 21:11:57 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Thu, 14 Nov 2024 05:12:41 GMT]]></title><description><![CDATA[<p dir="auto">Sorry <a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a>, this is my first MM project and I have no idea what I’m doing. So I didn’t understand that “fullscreen_above” was a position option for modules.</p>
<p dir="auto">In the screen shot below I left my clock the same as before with ‘z-index: 0’ on the apple and ‘z-index: 99’ on all the other classes of the clock. I then set my calendar module to “fullscreen_above” to see what would happen.</p>
<p dir="auto">Not easy to see in the screen shot but all of the components of the clock that have a z-index are on top of the calendar and the date which doesn’t have any z-index values is underneath the calendar. So it would appear that any z-index value, even 0, puts those components on top of “fullscreen_above”. So yes, it should be used carefully because it will peek through.</p>
<pre><code>{
	module: "clock",
	position: "top_left",
	config: {
		displayType: "analog",
		displaySeconds: false,
	}
},
{
	module: "calendar",
	header: "US Holidays",
	position: "fullscreen_above",
	config: {
		calendars: [
			{
</code></pre>
<p dir="auto"><img src="/assets/uploads/files/1731560893725-20241113_20h57m47s_grim.png" alt="20241113_20h57m47s_grim.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/post/121297</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121297</guid><dc:creator><![CDATA[ChrisLeduex]]></dc:creator><pubDate>Thu, 14 Nov 2024 05:12:41 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 18:10:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisleduex" aria-label="Profile: ChrisLeduex">@<bdi>ChrisLeduex</bdi></a> cool, it was just a question of implementation checking… good work</p>
]]></description><link>https://forum.magicmirror.builders/post/121271</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121271</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 13 Nov 2024 18:10:09 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 17:58:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sdetweil" aria-label="Profile: sdetweil">@<bdi>sdetweil</bdi></a> Larger numbers sit on top of smaller numbers. In this case I wanted to make sure the svg image was always underneath the clock face/hands  (z-index: 0) and the clock hands were always on top (z-index: 99). I could have used ‘z-index: 0’ and ‘z-index: 1’ instead but picked a larger number just to be sure the clock is always on top of anything else that might get added.</p>
<p dir="auto">I’m still working on it because I’d like to have a solution that doesn’t require any code changes to the module files. I’d like something that only requires using the custom.css file.</p>
<p dir="auto"><img src="/assets/uploads/files/1731520510290-20241113_07h50m20s_grim.png" alt="20241113_07h50m20s_grim.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.magicmirror.builders/post/121270</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121270</guid><dc:creator><![CDATA[ChrisLeduex]]></dc:creator><pubDate>Wed, 13 Nov 2024 17:58:52 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 13:22:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisleduex" aria-label="Profile: ChrisLeduex">@<bdi>ChrisLeduex</bdi></a> is z-index:99 below above?  so would be hidden by module in fullscreen_above. don’t want them peeking thru</p>
]]></description><link>https://forum.magicmirror.builders/post/121259</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121259</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 13 Nov 2024 13:22:56 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 13:20:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chrisleduex" aria-label="Profile: ChrisLeduex">@<bdi>ChrisLeduex</bdi></a> cool. you should submit that as an enhancement</p>
]]></description><link>https://forum.magicmirror.builders/post/121258</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121258</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Wed, 13 Nov 2024 13:20:43 GMT</pubDate></item><item><title><![CDATA[Reply to Adding background image to analog clock. on Wed, 13 Nov 2024 03:53:32 GMT]]></title><description><![CDATA[<p dir="auto">I found a way to make this work, though it’s not the cleanest.</p>
<p dir="auto">1:<br />
In the clock.js file I add these lines to the bottom of these sections:</p>
<pre><code>/************************************
* Create wrappers for analog and digital clock
*/
const analogBackground = document.createElement("div");
analogBackground.className = "clock-grid-background";
</code></pre>
<pre><code>/****************************************************************
* Create wrappers for ANALOG clock, only if specified in config
*/
clockFace.appendChild(analogBackground);
</code></pre>
<p dir="auto">2:<br />
Added this section to the clock_styles.css:<br />
Note the “z-index: 0;”</p>
<pre><code>.clock-grid-background {
  position: absolute;
  display: block;
  z-index: 0;
}
</code></pre>
<p dir="auto">I then added “z-index: 99;” to the following sections to make sure they stay on top:<br />
.clock-circle<br />
.clock-face<br />
.clock-face::after<br />
.clock-hour<br />
.clock-minute<br />
.clock-second</p>
<ol start="3">
<li></li>
</ol>
<p dir="auto">Added this code to the custom.css file:</p>
<pre><code>.clock-grid-background {
  -webkit-mask: url('apple-fresh-fruit-svgrepo-com.svg') center/cover no-repeat;
  //mask: url('apple-fresh-fruit-svgrepo-com.svg');
  display: block;
  margin: auto;
  margin-top: 60px;
  margin-left: 65px;
  height: 120px;
  width: 120px;
  background-color: var(--use_color);
}
</code></pre>
]]></description><link>https://forum.magicmirror.builders/post/121249</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/121249</guid><dc:creator><![CDATA[ChrisLeduex]]></dc:creator><pubDate>Wed, 13 Nov 2024 03:53:32 GMT</pubDate></item></channel></rss>