Weebly Tricks #84 — ClassyCountdown Timer
Add a clean countdown timer to your Weebly site, created by Marius Stanciu.
Learn how to customize and modify your Weebly site with new effects, plugins, and widgets.
Welcome to My Weebly Tricks, a resource for Weebly site owners who want to go beyond the basics. Here you'll find step-by-step guides on adding image effects, slideshows, navigation scripts, text animations, countdown timers, and more — all tailored for the Weebly platform.
A dark mode toggle gives visitors a choice between a light interface and a darker colour scheme. On a Weebly website, this can make evening browsing more comfortable, reduce glare on bright screens and give a blog, portfolio or small-business site a more modern feel. The change can be created with a small amount of CSS and JavaScript rather than a complete redesign.
Weebly does not provide a universal dark-theme switch in every editor template, so the most flexible approach is to add a button and control the colours with a class on the page. This method works with many standard themes and keeps the original light design available for visitors who prefer it.
A well-built toggle should do more than turn the background black. It needs readable text, visible links, usable buttons, sensible image treatment and a remembered preference. Testing on phones is especially important in Australia, where many visitors browse on mobile data while commuting through Sydney, Melbourne or Brisbane.
Dark mode can improve the experience of readers who visit your site at night or in low-light rooms. It is particularly useful for blogs, photography portfolios, gaming pages, technology websites and long-form resources where people may spend several minutes reading. A softer background can also help a design feel less intense on OLED mobile screens.
The feature should be treated as an optional viewing preference rather than a replacement for your existing design. Some users expect dark mode because their device is already set to a dark appearance, while others prefer a light page for contrast and printing. A toggle gives both groups control without forcing a single visual style.
Think about your brand colours before writing any code. A navy, charcoal or deep brown background often looks more polished than pure black. Accent colours may need adjustment because a bright red, green or blue that works on white can become difficult to read against a dark surface.
If you are refining the wider appearance of your site, review independent design resources such as Mischa Andriessen’s site for ideas about spacing, contrast and restrained visual presentation. Use inspiration carefully, since your Weebly theme, logo and audience should determine the final palette.
There are three common ways to add a dark appearance to Weebly. You can edit the theme files, insert custom code in the site-wide footer, or place an embed element on an individual page. For most site owners, the footer method is the most convenient because one script can work across the whole website.
A site-wide solution usually contains three parts: a toggle button in the page markup, CSS rules that define the dark colours, and JavaScript that adds or removes a class. The class can be applied to the body element, allowing the rest of the design to respond without changing every content block manually.
Before editing anything, create a backup of your theme or copy the existing custom code into a text file. Weebly’s editor may display code differently from the original source, and a misplaced script can affect menus, forms or responsive layouts. If your site uses several third-party widgets, add the dark-mode code gradually and test after each change.
The My Weebly Tricks about page explains the independent, practical nature of this type of resource. That context is useful when deciding whether to use a simple custom solution or seek a developer for a more complex theme-wide redesign.
Start by adding a button near the top of the page, such as inside the header or navigation area. In Weebly, an Embed Code element can be used for a page-specific button, while a theme template edit is better for a site-wide control. Give the button a descriptive label and an accessible attribute so screen-reader users understand what it does.
<button class="dark-mode-toggle"
type="button"
aria-pressed="false"
aria-label="Switch to dark mode">
Dark mode
</button>
Next, add CSS that changes the main surfaces, text, links and common Weebly components. The exact selectors depend on your theme, so inspect the page and add selectors for custom sections where necessary.
body.dark-mode {
background: #17191c;
color: #f1f3f5;
}
body.dark-mode .wsite-section,
body.dark-mode .wsite-header-section,
body.dark-mode .wsite-footer {
background-color: #17191c;
}
body.dark-mode p,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
color: #f1f3f5;
}
body.dark-mode a {
color: #8ecbff;
}
body.dark-mode .dark-mode-toggle {
background: #f1f3f5;
color: #17191c;
}
JavaScript can save the visitor’s choice in local storage. This means the preference remains when the person moves between pages or returns later. The script below also updates the button text and aria-pressed value.
<script>
(function () {
const button = document.querySelector('.dark-mode-toggle');
const savedMode = localStorage.getItem('weebly-dark-mode');
if (!button) return;
if (savedMode === 'on') {
document.body.classList.add('dark-mode');
button.setAttribute('aria-pressed', 'true');
button.textContent = 'Light mode';
}
button.addEventListener('click', function () {
const isDark = document.body.classList.toggle('dark-mode');
localStorage.setItem('weebly-dark-mode', isDark ? 'on' : 'off');
button.setAttribute('aria-pressed', String(isDark));
button.textContent = isDark ? 'Light mode' : 'Dark mode';
});
})();
</script>
For a smoother result, add a short transition to the relevant elements, but keep it subtle. Excessive animation can make the change feel slow, especially for visitors on older phones. You can also respect the visitor’s operating-system preference with prefers-color-scheme, although a manual choice should take priority after the visitor clicks the toggle.
For a site-wide implementation, sign in to Weebly and open the site settings or theme area where custom header and footer code is available. Paste the CSS into the appropriate style section and place the JavaScript near the end of the footer code. Add the button in the header template if you want it visible on every page.
The names of Weebly controls can vary according to the editor version and account setup. Look for options such as theme code, Edit HTML/CSS, header code or footer code. If your plan does not expose theme files, an Embed Code element can hold the button and a code section can often hold the CSS and script. A page-level solution is suitable for testing before making the feature global.
Keep the code in one organised block and add comments explaining each part. Do not paste the same script into several pages, because duplicate event listeners may cause unexpected behaviour. If you use a newsletter form, popup, booking widget or ecommerce element, check that the dark styles do not make fields and error messages disappear.
A related example is the Weebly newsletter popup guide, which illustrates how custom code can extend a standard Weebly site. A dark-mode style should complement such elements by covering their overlay, panel, input and submit button colours rather than changing only the page behind them.
Contrast is the most important test. Light grey text on a medium grey background can look attractive in a design mock-up but become difficult to read in practice. Aim for strong contrast between body text and its background, and check links, placeholder text, form labels, buttons and navigation separately. Do not rely on colour alone to show whether a link or control is active.
Use the toggle with a keyboard by pressing Tab and Enter or Space. The focus outline must remain visible in both themes. Confirm that the button has a clear name, that its pressed state changes correctly, and that the page does not jump when the control is activated. Lighthouse, browser developer tools and contrast checkers can help identify obvious problems, though manual testing remains essential.
Open the site on an iPhone and Android phone, then test common browsers such as Chrome, Safari and Firefox. Australian visitors may use a phone over public Wi-Fi, an NBN connection at home or mobile data during a train trip. Avoid large background images and unnecessary scripts so the toggle appears quickly rather than waiting for a heavy page to finish loading.
Privacy also deserves attention. Storing a simple preference in local storage normally does not identify a visitor, but review your analytics, advertising and cookie arrangements separately. If the wider site collects personal information, make sure your privacy notice reflects your practices and aligns with obligations under Australia’s Privacy Act and the Australian Privacy Principles. A visual preference should never be used as a reason to collect extra personal data.
A polished switch depends on details beyond the basic code. Review every template and page type, including blog posts, product pages, contact forms and landing pages. Pay attention to logos with transparent backgrounds, screenshots containing white interfaces and decorative images that may look harsh against a dark surface.
Use these practical checks before publishing:
It is also worth deciding whether the control should appear as text, a sun-and-moon icon or both. Text is usually clearest for general audiences, while an icon can save space in a compact header. If you use an icon, include an accessible label and do not assume that every visitor will recognise its meaning.
Review the design after a few days of real use. Watch for pages where text is hard to see, embedded content ignores the theme or a cookie banner remains bright while the rest of the page is dark. Those issues can usually be solved by adding a more specific CSS selector or adjusting the component’s own settings.
A dark mode toggle is a small enhancement, but it can influence how comfortable people feel while reading and navigating your Weebly site. Add the feature in a test version first, inspect it on mobile and desktop, and then publish it once the colours, controls and saved preference behave consistently. Keep the original light view available so every visitor can choose the setting that suits their device, environment and accessibility needs.
Add a clean countdown timer to your Weebly site, created by Marius Stanciu.
A comparison of free and paid email accounts and the advantages of using a domain-based custom email.
Instructions on setting a free custom email address for your website within Weebly.
Configure your Weebly RSS feed so visitors can subscribe and receive email updates.
Details on a promotional offer for two months of free email hosting from Namecheap.
Subscribe for regular email updates and get access to new Weebly tips and tutorials.