Skip to content

SudhirDevOps1/CLOCK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โฐ Sudhir's Clock

A Stunning, Feature-Rich Analog & Digital Clock Experience

Live Demo Version License Stars


Sudhir's Clock Preview

A beautiful, fully responsive, real-time analog + digital clock built with pure HTML, CSS & JavaScript. No frameworks. No dependencies. Just pure craftsmanship.


Features โ€ข Screenshots โ€ข Quick Start โ€ข Themes โ€ข Architecture โ€ข Customization โ€ข API Reference โ€ข Contributing



๐ŸŒŸ Why Sudhir's Clock?

Most clock apps are boring. This one isn't.

Sudhir's Clock isn't just a clock โ€” it's a visual experience. Built from scratch with zero dependencies, it combines a mesmerizing multi-ring analog clock with powerful utilities like stopwatch, timer, and world clocks โ€” all wrapped in a gorgeous glassmorphic UI that adapts perfectly to every screen size.


โœจ Features

๐Ÿ• Core Clock

Feature Description
Multi-Ring Analog Clock 7 concentric rings showing seconds, minutes, hours, days, months, years, and weekdays
Digital Time Display Large, beautiful digital readout with blinking colons and gradient text
Real-Time Rotation Smooth CSS transitions with cubic-bezier easing for fluid ring movement
12/24 Hour Format Toggle between formats instantly โ€” clock rings adapt dynamically
20% Glass Overlay Subtle depth effect without hiding the clock โ€” every number stays visible
Rotating Glow Ring Animated outer ring with accent-colored conic gradient
Active Number Highlight Current values glow with accent color and scale animation

โฑ๏ธ Stopwatch

Feature Description
Millisecond Precision Accurate to the millisecond with ~31ms refresh rate
Lap Recording Record unlimited laps with individual timestamps
Start/Pause/Resume Full playback control with visual state indicators
Lap History Scrollable list with highlighted best lap

โณ Countdown Timer

Feature Description
Custom Duration Set hours, minutes, and seconds independently
Vibration Alert Haptic feedback on mobile when timer completes
Toast Notification Visual notification with accent-colored alert
Pause/Resume Full control without losing countdown state

๐ŸŒ World Clocks

Feature Description
8 Major Cities New York, London, Tokyo, Dubai, Sydney, Paris, Mumbai, Singapore
UTC Offset Display Shows UTC+/- offset for each timezone
Locale-Aware Time format adapts to selected language
Real-Time Updates All clocks update every second simultaneously

๐Ÿ“Š Time Progress

Feature Description
Day Progress Percentage of current day completed
Week Progress Current position in the week
Month Progress How far through the current month
Year Progress Annual progress with gradient fill bars
Animated Bars Smooth width transitions with glow effects

๐ŸŽจ Theming & Customization

Feature Description
9 Color Themes Ember, Emerald, Violet, Rose, Cyan, Gold, Ocean, Pink, Lime
Persistent Themes Selection saved to localStorage automatically
CSS Variable System Every color derives from theme variables
Ambient Gradients Background adapts to selected accent color

๐ŸŒ Internationalization

Feature Description
30 Languages Full support via Intl.DateTimeFormat API
Circular Selector Beautiful radial flag picker dialog
Auto-Detection Defaults to browser's preferred language
Dynamic Updates Clock rings, date display, and world clocks all adapt

๐Ÿ“ฑ Responsive Design

Feature Description
7 Breakpoints 1200px, 900px, 680px, 420px, 340px, landscape, print
Mobile Bottom Nav Touch-friendly navigation bar on small screens
Auto-Hide Topbar Hides on scroll down, reappears on scroll up
Safe Area Support Proper padding for notched devices
Landscape Mode Horizontal layout for phones in landscape
Dynamic Viewport Uses 100dvh for accurate mobile height

โšก Performance

Feature Description
Zero Dependencies Pure HTML + CSS + JS โ€” nothing else
Single RAF Loop Efficient requestAnimationFrame rendering
Passive Listeners Scroll events use { passive: true }
Debounced Resize Clock redraws throttled at 200ms
IIFE Encapsulation No global scope pollution
Optimized Particles Squared distance check (avoids sqrt until needed)

โ™ฟ Accessibility

Feature Description
ARIA Labels Screen reader support for all interactive elements
Keyboard Shortcuts F = Fullscreen, S = Settings, Esc = Close
Focus Visible Clear focus indicators for keyboard navigation
Reduced Motion Respects prefers-reduced-motion media query
High Contrast Enhanced borders and text for prefers-contrast: high
Print Styles Clean, ink-friendly output when printing

๐Ÿ“ธ Screenshots

๐Ÿ–ฅ๏ธ Desktop View

Desktop

๐Ÿ“ฑ Mobile View

Mobile Clock Mobile Tools Mobile Settings

๐ŸŽจ Theme Showcase

Themes

๐Ÿš€ Quick Start

Option 1: Direct Download

# Clone the repository
git clone https://github.com/SudhirDevOps1/CLOCK.git

# Navigate to directory
cd CLOCK

# Open in browser (no build step needed!)
open index.html

Option 2: CDN / Direct Link

<!-- Just drop this single file into your project -->
<iframe src="https://sudhir-clock.vercel.app" width="100%" height="600"></iframe>

Option 3: Embed as Widget

<!-- Minimal embed -->
<div id="sudhir-clock" style="width:400px;height:400px;">
  <iframe
    src="https://sudhir-clock.vercel.app"
    style="width:100%;height:100%;border:none;border-radius:20px;"
    loading="lazy"
  ></iframe>
</div>

Option 4: NPM (Coming Soon)

npm install @sudhir/clock

๐ŸŽจ Themes

All themes are powered by CSS custom properties and can be switched instantly:

Theme Primary Secondary Preview
Ember ๐Ÿ”ฅ #ff6b35 #ff8c42 #ff6b35
Emerald ๐Ÿ’š #10b981 #34d399 #10b981
Violet ๐Ÿ’œ #8b5cf6 #a78bfa #8b5cf6
Rose ๐ŸŒน #f43f5e #fb7185 #f43f5e
Cyan ๐ŸงŠ #06b6d4 #22d3ee #06b6d4
Gold โญ #f59e0b #fbbf24 #f59e0b
Ocean ๐ŸŒŠ #3b82f6 #60a5fa #3b82f6
Pink ๐ŸŒธ #ec4899 #f472b6 #ec4899
Lime ๐Ÿ€ #84cc16 #a3e635 #84cc16

Creating a Custom Theme

[data-theme="custom"] {
    --accent: #your-color;
    --accent-2: #your-lighter-color;
    --accent-3: #your-lightest-color;
    --accent-glow: rgba(r, g, b, 0.35);
    --accent-soft: rgba(r, g, b, 0.08);
    --accent-mid: rgba(r, g, b, 0.18);
    --shadow-glow: 0 0 100px rgba(r, g, b, 0.06);
}

Then add a button in the theme grid:

<button class="theme-btn" data-theme="custom">
    <div class="theme-dot" style="background:linear-gradient(135deg, #color1, #color2)"></div>
    <span>Custom</span>
</button>

๐Ÿ—๏ธ Architecture

File Structure

CLOCK/
โ”œโ”€โ”€ index.html          # Single-file application (HTML + CSS + JS)
โ”œโ”€โ”€ README.md           # This documentation
โ”œโ”€โ”€ LICENSE             # MIT License
โ”œโ”€โ”€ CHANGELOG.md        # Version history
โ”œโ”€โ”€ CONTRIBUTING.md     # Contribution guidelines
โ”œโ”€โ”€ .github/
โ”‚   โ”œโ”€โ”€ ISSUE_TEMPLATE/
โ”‚   โ”‚   โ”œโ”€โ”€ bug_report.md
โ”‚   โ”‚   โ””โ”€โ”€ feature_request.md
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ deploy.yml  # Auto-deploy to Vercel/Pages
โ””โ”€โ”€ assets/
    โ”œโ”€โ”€ hero-preview.png
    โ”œโ”€โ”€ desktop-preview.png
    โ”œโ”€โ”€ mobile-clock.png
    โ”œโ”€โ”€ mobile-tools.png
    โ”œโ”€โ”€ mobile-settings.png
    โ”œโ”€โ”€ themes-grid.png
    โ”œโ”€โ”€ og-image.png    # Open Graph preview
    โ””โ”€โ”€ favicon.ico

Component Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    APPLICATION                       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚  Loader   โ”‚  โ”‚  Canvas  โ”‚  โ”‚  Ambient Gradient โ”‚  โ”‚
โ”‚  โ”‚  Screen   โ”‚  โ”‚ Particlesโ”‚  โ”‚    Background     โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚              Navigation Layer                 โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚   โ”‚
โ”‚  โ”‚  โ”‚   Topbar     โ”‚      โ”‚   Bottom Nav     โ”‚   โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  (Desktop)   โ”‚      โ”‚    (Mobile)      โ”‚   โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚                Main Content                   โ”‚   โ”‚
โ”‚  โ”‚                                               โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚   โ”‚
โ”‚  โ”‚  โ”‚Greeting โ”‚  โ”‚    Digital Time Display     โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚   โ”‚
โ”‚  โ”‚                                               โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚         Analog Clock (7 Rings)         โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  โ”‚  Years โ†’ Seconds โ†’ Minutes โ†’    โ”‚   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  โ”‚  Hours โ†’ Days โ†’ Months โ†’        โ”‚   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  โ”‚  Weekdays โ†’ [Center Button]     โ”‚   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚  โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚   โ”‚
โ”‚  โ”‚                                               โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚   โ”‚
โ”‚  โ”‚  โ”‚Info Cardsโ”‚ โ”‚  Tools   โ”‚ โ”‚ World Clocks โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ”‚ (6 cards)โ”‚ โ”‚ SW/Timer โ”‚ โ”‚  (8 cities)  โ”‚ โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚   โ”‚
โ”‚  โ”‚                                               โ”‚   โ”‚
โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚   โ”‚
โ”‚  โ”‚  โ”‚        Progress Bars (4)             โ”‚    โ”‚   โ”‚
โ”‚  โ”‚  โ”‚  Day | Week | Month | Year           โ”‚    โ”‚   โ”‚
โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Settings Panelโ”‚  โ”‚    Language Dialog        โ”‚   โ”‚
โ”‚  โ”‚  (Slide-in)   โ”‚  โ”‚   (Modal + Radial UI)    โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Scroll โ†‘ โ”‚  โ”‚Fullscreenโ”‚  โ”‚     Toasts     โ”‚   โ”‚
โ”‚  โ”‚  Button  โ”‚  โ”‚  Button  โ”‚  โ”‚  (Notifications)โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                                                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Clock Ring Structure

Ring 1 (Outermost): Years      [2000 - 2100]  101 values
Ring 2:             Seconds    [00 - 59]       60 values
Ring 3:             Minutes    [00 - 59]       60 values
Ring 4:             Hours      [00 - 23/1-12]  24/12 values
Ring 5:             Days       [1 - 28/29/30/31] Dynamic
Ring 6:             Months     [Jan - Dec]      12 values
Ring 7 (Innermost): Weekdays   [Sun - Sat]      7 values
Center:             Language Button (๐ŸŒ)

Data Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Date()     โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Main Loop   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚  Digital    โ”‚
โ”‚  Object     โ”‚     โ”‚  (RAF)       โ”‚     โ”‚  Display    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚              โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  Analog   โ”‚ โ”‚   Info     โ”‚
              โ”‚  Clock    โ”‚ โ”‚   Cards    โ”‚
              โ”‚  Rotation โ”‚ โ”‚   Update   โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚  World Clocks     โ”‚
              โ”‚  (per-second)     โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Customization

CSS Variables Reference

:root {
    /* โ”€โ”€ Colors โ”€โ”€ */
    --bg-1: #06060b;              /* Darkest background */
    --bg-2: #0e0e18;              /* Card backgrounds */
    --bg-3: #161625;              /* Elevated surfaces */
    --bg-4: #1e1e32;              /* Highest elevation */

    --accent: #ff6b35;            /* Primary accent */
    --accent-2: #ff8c42;          /* Secondary accent */
    --accent-3: #ffab76;          /* Tertiary accent */
    --accent-glow: rgba(โ€ฆ, 0.35); /* Glow/shadow color */
    --accent-soft: rgba(โ€ฆ, 0.08); /* Subtle backgrounds */
    --accent-mid: rgba(โ€ฆ, 0.18);  /* Medium emphasis */

    --text-1: #f0f0f5;            /* Primary text */
    --text-2: rgba(โ€ฆ, 0.65);      /* Secondary text */
    --text-3: rgba(โ€ฆ, 0.35);      /* Tertiary text */
    --text-4: rgba(โ€ฆ, 0.18);      /* Quaternary text */

    /* โ”€โ”€ Glass โ”€โ”€ */
    --glass: rgba(255,255,255, 0.025);
    --glass-2: rgba(255,255,255, 0.045);
    --glass-border: rgba(255,255,255, 0.055);
    --glass-border-2: rgba(255,255,255, 0.09);
    --glass-hover: rgba(255,255,255, 0.07);

    /* โ”€โ”€ Layout โ”€โ”€ */
    --clock-size: min(78vmin, 680px);
    --topbar-h: 54px;
    --bottombar-h: 0px; /* 58px on mobile */
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;

    /* โ”€โ”€ Clock โ”€โ”€ */
    --clock-mask-opacity: 0.20;   /* 20% overlay */

    /* โ”€โ”€ Transitions โ”€โ”€ */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-med: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

Modifying Clock Rings

Each ring's size is controlled by --cd (diameter) and --cf (font-size):

/* Example: Make the seconds ring larger */
.clock > div:nth-of-type(2) {
    --cd: calc(var(--clock-size) - 60px); /* diameter */
    --cf: 0.8rem;                          /* font size */
}

Adding a New Clock Ring

<!-- Add inside .clock, before center-btn -->
<div><div data-clock="custom" data-numbers="10" class="clock-face"></div></div>
// Add case in drawClockFaces() switch:
case 'custom':
    vals = ['A','B','C','D','E','F','G','H','I','J'];
    cv = someValue;
    break;

// Add case in rotateClockFaces() tick():
case 'custom':
    val = someComputedValue;
    break;

Adding a New World Clock City

// Add to the cities array:
const cities = [
    // ... existing cities
    { city: 'Berlin', tz: 'Europe/Berlin', e: '๐Ÿ‡ฉ๐Ÿ‡ช' },
];

Changing Particle Count & Behavior

// Increase particles (default: 45)
for (let i = 0; i < 80; i++) particles.push(new Particle());

// Change particle speed
this.vx = (Math.random() - 0.5) * 0.5; // faster (default: 0.25)

// Change connection distance
if (d < 15000) { // larger radius (default: 10000 = 100pxยฒ)

๐Ÿ“– API Reference

Global State

Variable Type Default Description
locale string Browser default Current language code (e.g., 'en-US')
is24h boolean true 24-hour format enabled
smoothSec boolean false Smooth second hand animation
particlesOn boolean true Background particles enabled

Key Functions

Function Description
drawClockFaces() Rebuilds all clock ring elements (call after locale/format change)
rotateClockFaces() Starts the continuous rotation animation loop
updateDigital() Updates digital display, info cards, and progress bars
updateWorld() Refreshes all world clock displays
updateGreeting() Sets greeting based on time of day
toast(msg, icon) Shows a toast notification
openPanel() / closePanel() Controls settings panel
openLang() / closeLang() Controls language dialog
toggleFS() Toggles fullscreen mode
setFormat(bool) Sets 12/24 hour format

Keyboard Shortcuts

Key Action
F Toggle fullscreen
S Open settings panel
Esc Close any open panel/dialog

Events Handled

Event Handler
scroll Auto-hide topbar, show scroll-to-top
resize Debounced clock redraw
orientationchange Delayed clock redraw
visibilitychange Refresh data when tab becomes visible
mousemove (buttons) Radial gradient ripple effect

๐ŸŒ Supported Languages

๐Ÿ‡ธ๐Ÿ‡ฆ Arabic๐Ÿ‡จ๐Ÿ‡ฟ Czech๐Ÿ‡ฉ๐Ÿ‡ฐ Danish๐Ÿ‡ฉ๐Ÿ‡ช German๐Ÿ‡ฌ๐Ÿ‡ท Greek
๐Ÿ‡บ๐Ÿ‡ธ English (US)๐Ÿ‡ฌ๐Ÿ‡ง English (UK)๐Ÿ‡ช๐Ÿ‡ธ Spanish๐Ÿ‡ฒ๐Ÿ‡ฝ Spanish (MX)๐Ÿ‡ซ๐Ÿ‡ฎ Finnish
๐Ÿ‡จ๐Ÿ‡ฆ French (CA)๐Ÿ‡ซ๐Ÿ‡ท French๐Ÿ‡ฎ๐Ÿ‡ฑ Hebrew๐Ÿ‡ฎ๐Ÿ‡ณ Hindi๐Ÿ‡ญ๐Ÿ‡บ Hungarian
๐Ÿ‡ฎ๐Ÿ‡น Italian๐Ÿ‡ฏ๐Ÿ‡ต Japanese๐Ÿ‡ฐ๐Ÿ‡ท Korean๐Ÿ‡ณ๐Ÿ‡ฑ Dutch๐Ÿ‡ณ๐Ÿ‡ด Norwegian
๐Ÿ‡ต๐Ÿ‡ฑ Polish๐Ÿ‡ง๐Ÿ‡ท Portuguese (BR)๐Ÿ‡ต๐Ÿ‡น Portuguese๐Ÿ‡ท๐Ÿ‡ด Romanian๐Ÿ‡ท๐Ÿ‡บ Russian
๐Ÿ‡ธ๐Ÿ‡ช Swedish๐Ÿ‡น๐Ÿ‡ญ Thai๐Ÿ‡น๐Ÿ‡ท Turkish๐Ÿ‡ป๐Ÿ‡ณ Vietnamese๐Ÿ‡จ๐Ÿ‡ณ Chinese

๐Ÿ“ฑ Browser Support

Browser Version Status
Chrome 90+ โœ… Full Support
Firefox 88+ โœ… Full Support
Safari 15+ โœ… Full Support
Edge 90+ โœ… Full Support
Opera 76+ โœ… Full Support
Samsung Internet 15+ โœ… Full Support
iOS Safari 15+ โœ… Full Support
Chrome Android 90+ โœ… Full Support

Progressive Enhancement

Feature Fallback
backdrop-filter Solid background color
dvh units Falls back to vh
@starting-style No animation on dialog open
env(safe-area-inset) Zero padding
Fullscreen API Button hidden
Vibration API Silent fallback
navigator.language Defaults to en-US

โšก Performance Metrics

Metric Value
First Contentful Paint ~0.4s
Largest Contentful Paint ~0.8s
Total Blocking Time ~10ms
Cumulative Layout Shift 0
Bundle Size ~28KB (single file, no gzip)
Dependencies 0
DOM Nodes ~450 (with all rings)
Animation Frames Stable 60fps
Memory Usage ~8MB
Lighthouse Score 95+ (Performance)

๐Ÿ› ๏ธ Development

Prerequisites

  • Any modern web browser
  • A text editor (VS Code recommended)
  • Optional: Live Server extension for hot reload

Local Development

# Clone
git clone https://github.com/SudhirDevOps1/CLOCK.git
cd CLOCK

# Start with VS Code Live Server
# Or use any static server:
npx serve .
# or
python -m http.server 8080
# or
php -S localhost:8080

Code Style

  • CSS: BEM-inspired naming, CSS custom properties for theming
  • JavaScript: IIFE pattern, $() helper for DOM queries, const/let only
  • HTML: Semantic elements, ARIA attributes, minimal nesting

Testing Checklist

โ–ก Desktop Chrome (1920x1080)
โ–ก Desktop Firefox (1920x1080)
โ–ก Desktop Safari (1920x1080)
โ–ก Tablet Portrait (768x1024)
โ–ก Tablet Landscape (1024x768)
โ–ก Mobile Portrait (375x812)
โ–ก Mobile Landscape (812x375)
โ–ก Small Phone (320x568)
โ–ก Large Phone (428x926)
โ–ก 4K Display (3840x2160)
โ–ก Reduced Motion ON
โ–ก High Contrast ON
โ–ก Print Preview
โ–ก Keyboard-only Navigation
โ–ก Screen Reader (VoiceOver/NVDA)

๐Ÿ—บ๏ธ Roadmap

v2.1 (Planned)

  • ๐Ÿ”” Alarm functionality with custom sounds
  • ๐ŸŒ“ Light/Dark mode toggle
  • ๐Ÿ“… Calendar integration
  • ๐ŸŽต Ambient sounds (rain, fireplace, etc.)
  • ๐Ÿ“Š Time tracking / Pomodoro timer

v2.2 (Future)

  • ๐Ÿ”„ PWA support (installable app)
  • ๐Ÿ”— Shareable clock configurations via URL
  • ๐Ÿ–ผ๏ธ Custom background images
  • โŒจ๏ธ More keyboard shortcuts
  • ๐ŸŒ Additional world clock cities (configurable)

v3.0 (Vision)

  • ๐Ÿงฉ Widget/Component mode (embed anywhere)
  • ๐Ÿ“ฑ Native mobile app (Capacitor)
  • ๐ŸŽจ Theme creator/editor UI
  • ๐Ÿ”Š Voice announcements
  • ๐Ÿค– AI-powered time insights

๐Ÿค Contributing

Contributions are welcome! Please read the Contributing Guidelines first.

How to Contribute

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Contribution Ideas

Area Ideas
๐ŸŽจ Themes New color schemes, light mode, dark OLED mode
๐ŸŒ Languages Add more language packs, RTL improvements
๐ŸŒ World Clocks Searchable city picker, timezone map
โšก Performance Web Worker for calculations, virtual scrolling
โ™ฟ Accessibility Screen reader improvements, voice control
๐Ÿ“ฑ Mobile Gesture controls, haptic feedback improvements
๐Ÿงช Testing Unit tests, E2E tests, visual regression tests
๐Ÿ“– Documentation Tutorials, video demos, API examples

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.

MIT License

Copyright (c) 2024 Sudhir Kumar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

๐Ÿ™ Acknowledgments

  • Fonts: Google Fonts โ€” Outfit & JetBrains Mono
  • Inspiration: Swiss railway clocks, modern dashboard UIs
  • Icons: Custom SVG inline icons (no icon library needed)
  • Timezone Data: Native Intl.DateTimeFormat API

๐Ÿ“Š Stats

GitHub repo size GitHub code size GitHub last commit GitHub issues GitHub pull requests


โญ Star this repository if you found it useful!


Built with โค๏ธ and โ˜• by Sudhir Kumar


wave

About

advanced clock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages