Clock

<o-clock> is an analog clock or watch face, live or set to a time.

The dial is the universe: ticks are vectors on orbit-11, numerals are satellites on orbit-9, and the hands are vectors on the center orbit, turned with --o-angle-composite. Sub-dials are satellites that hold a universe of their own. A live clock only moves its hands; the face is built once.

Presets

classic, roman, minimal, chrono and smartwatch. As with instruments, any attribute you write wins over the preset.

Attributes

AttributeDefaultWhat it does
timenowA fixed time, HH:MM or HH:MM:SS.
liveoffFollows the real clock, once a second.
smoothoffA sweeping second hand, redrawn every frame. Implies seconds.
secondsoffShows the second hand.
numeralsarabicarabic, roman or none.
caseroundround, square, rounded or rectangle.
dialroundoval stretches the dial to follow the case; rings replaces the hands with three activity rings.
digitaloffA digital time below the center.
dateoffA date window at 3 o'clock.
brandA name above the center.
subdialsoffChronograph sub-dials: small seconds, 24 hours and date. They replace digital and date.
accent / hand-color / tick-colorSecond hand and cap, hour and minute hands, minute ticks.
face / bezel / case-bgDial background, its rim and the case around it.
hour-color / minute-color / second-colorRing colors of dial="rings".
size300pxWidth of the widget. A rectangle case is 1.26 times as tall.
glowoffA glow on the hands.
themedark, light or glass. Also inherited from an ok-theme-* class on a container. See Shared options.

Styling

PropertyFalls back toWhat it does
--ok-clock-accent--ok-accentSecond hand, cap, brand.
--ok-clock-handHour and minute hands.
--ok-clock-face--ok-faceDial background.
--ok-clock-bezel--ok-bezelDial rim.
--ok-clock-case-bg--ok-caseCase around a non-round dial.
--ok-clock-tick--ok-tickMinute ticks.
--ok-clock-tick-hHour ticks.
--ok-clock-numeral--ok-textNumerals and readouts.
--ok-font-sizeBase text size, 7.5cqmin by default.

More examples

A tonneau watch

Activity rings for hours, minutes and seconds

A light face

Accessibility

The clock has role="img" and its time as the name, like “10:08:30”. The name follows the time, but a screen reader does not announce each change. Set aria-label to give it a fixed name, such as “Time in Tokyo”. The live loop stops while the clock is out of the document.