Clock_S - Customizable Pixel Clock
Small centered clock HH:MM or HH:MM:SS with customizable color and blinking colon
| System | AWTRIX NG Scripts |
|---|---|
| Firmware | AWTRIX NG |
| Topic | Miscellaneous |
| Built by | Avemer |
| File | FeQ2kYpQoh5l.ax · 5.6 KB |
| Icons | — |
| Published | 9 Aug 2026 · updated 31 Aug 2026 |
| Downloads | 51 |
Inspired by the work of RobG.
- This script uses ideas and implementation approaches from RobG's original nightmode clock.
Update 1.3
- Added configurable 12/24-hour time format.
- Added configurable Night Mode with custom start and end times.
- Added separate day/night clock colors.
- Added separate day/night brightness settings.
- Added separate day/night automatic brightness settings.
- Added option to disable app rotation during Night Mode.
- Added automatic handling of night periods that cross midnight (e.g. 23:00 → 08:00).
- Added configurable settings through the AWTRIX app configuration interface.
- Added support for
true/falseboolean configuration values. - Improved handling of the 12/24-hour format selection.
Changed:
- Clock settings are now changed through the AWTRIX configuration section.
- The hour format is selected through the configuration interface:
24— 24-hour format12— 12-hour format
- Night Mode automatically switches between day and night settings without interrupting the clock.
- Night Mode remains active after midnight until the configured Night End time.
- Improved configuration handling for clock appearance, brightness and rotation.
- Boolean settings use standard
true/falsevalues.
Update 1.2
- Added Night Mode — automatically switches the clock to a separate night configuration during the selected time range.
- Configurable Night Schedule — set the start and end time of Night Mode using HH:MM.
- Configurable Brightness — separate brightness and automatic-brightness settings for day and night.
- Night Clock Color — choose a separate color for the clock during Night Mode.
- Night Rotation Control — optionally disable app rotation during Night Mode so the clock stays on screen.
- Automatic Rotation Handling — when Night Rotation is enabled, the clock stays visible during Night Mode and normal rotation resumes when Night Mode ends.
- Midnight-Crossing Schedule — Night Mode supports periods such as 23:00 → 08:00.
New Settings:
-
hour_format
Select the clock format from the AWTRIX configuration menu.
24— 24-hour format
Example:13:45
12— 12-hour format
Example:01:45 -
blink_colon
Controls whether the:blinks.
true— colon blinks once per second
false— colon stays permanently visible -
NIGHT_MODE_ENABLED
true— Night Mode enabled
false— Night Mode disabled -
NIGHT_START
Night Mode start time.
Format:HH:MM
Example:
23:00 -
NIGHT_END
Night Mode end time.
Format:HH:MM
Example:
08:00 -
NIGHT_CLOCK_COLOR
Clock color used during Night Mode.
Format: RGB hexadecimal color.
Example:
#FF0000 -
NIGHT_ROTATION_ENABLED
true— disable app rotation during Night Mode
Clock_XL stays on screen.
false— keep normal app rotation
Only the night appearance changes. -
Brightness
NIGHT_BRIGHTNESS
Brightness used during Night Mode.
Range:0–255
DAY_BRIGHTNESS
Brightness used during normal/day mode.
Range:1–255 -
Automatic Brightness
NIGHT_AUTO_BRIGHTNESS
true— automatic brightness during Night Mode
false— fixed Night brightness
DAY_AUTO_BRIGHTNESS
true— automatic brightness during normal/day mode
false— fixed Day brightness
Example configuration
hour_format = 24
blink_colon = true
NIGHT_MODE_ENABLED = true
NIGHT_START = "23:00"
NIGHT_END = "08:00"
NIGHT_CLOCK_COLOR = #FF0000
NIGHT_BRIGHTNESS = 1
DAY_BRIGHTNESS = 127
NIGHT_ROTATION_ENABLED = true
FEATURES
- Configurable 12/24-hour time format
- Centered on the 32×8 AWTRIX display
- Customizable day clock color
- Customizable night clock color
- Optional blinking colon
- Colon blinks once per second when enabled
- Configurable Night Mode schedule
- Separate day/night brightness
- Separate day/night automatic brightness
- Optional disabling of app rotation during Night Mode
- Supports Night Mode periods crossing midnight
- Configurable through the AWTRIX app configuration interface
- Designed specifically for AWTRIX 3 Berry scripting
Display
The clock displays the current time using large custom pixel digits:
HH:MM
Example in 24-hour mode:
13:45
Example in 12-hour mode:
01:45
The clock does not display seconds or an AM/PM indicator.
The script uses the AWTRIX draw() loop, so the displayed time updates automatically.
GENERAL
- The code contains explanations if you want to change something.
- The design of each digit and colon is written in the code and can be changed manually.
- Configuration values are exposed through the AWTRIX app configuration interface.
hour_formatis handled as a string because it is aselectconfiguration value.- Boolean settings such as
blink_colon,night_modeandnight_rotationusetrue/false.
Vibecoded with ChatGPT, polished by Avemer.
And I'm a newbie, hope someone might find this script useful!
FeQ2kYpQoh5l.ax
# @name Clock_S
# @desc Small centered clock HH:MM or HH:MM:SS with 12/24h format, day/night mode, brightness and rotation control
# @author Avemer
# @version 1.3
# @config hour_format select "Hour format" default=24 options=24,12
# @config show_seconds bool "Show seconds" default=true
# @config blink_colon bool "Blink colon" default=true
# @config clock_color color "Day clock color" default=#FFFFFF
# @config day_brightness slider "Day brightness" default=127 min=1 max=255
# @config day_auto_brightness bool "Day auto brightness" default=false
# @config night_mode bool "Night mode" default=true
# @config night_start text "Night start" default="23:00" maxlen=5
# @config night_end text "Night end" default="08:00" maxlen=5
# @config night_color color "Night clock color" default=#FF0000
# @config night_brightness slider "Night brightness" default=10 min=0 max=255
# @config night_auto_brightness bool "Night auto brightness" default=false
# @config night_rotation bool "Disable rotation at night" default=true
class Clock
# USER VARIABLES
var HOUR_FORMAT
var SHOW_SECONDS
var BLINK_COLON
var CLOCK_COLOR
var DAY_BRIGHTNESS
var DAY_AUTO_BRIGHTNESS
var NIGHT_MODE_ENABLED
var NIGHT_START
var NIGHT_END
var NIGHT_CLOCK_COLOR
var NIGHT_BRIGHTNESS
var NIGHT_AUTO_BRIGHTNESS
var NIGHT_ROTATION_ENABLED
# INTERNAL VARIABLES
var night_start_m
var night_end_m
var night_mode
var last_night_mode
# INITIALIZATION
def init()
# SELECT returns a string value.
# Keep it as string: "12" or "24".
self.HOUR_FORMAT = str(
store.get("hour_format")
)
# Boolean settings.
self.SHOW_SECONDS = store.get("show_seconds")
self.BLINK_COLON = store.get("blink_colon")
self.CLOCK_COLOR = store.get("clock_color")
self.DAY_BRIGHTNESS = store.get("day_brightness")
self.DAY_AUTO_BRIGHTNESS = store.get("day_auto_brightness")
self.NIGHT_MODE_ENABLED = store.get("night_mode")
self.NIGHT_START = store.get("night_start")
self.NIGHT_END = store.get("night_end")
self.NIGHT_CLOCK_COLOR = store.get("night_color")
self.NIGHT_BRIGHTNESS = store.get("night_brightness")
self.NIGHT_AUTO_BRIGHTNESS = store.get("night_auto_brightness")
self.NIGHT_ROTATION_ENABLED = store.get("night_rotation")
# Parse night mode times.
self.night_start_m = self.parse_min(
self.NIGHT_START,
23 * 60
)
self.night_end_m = self.parse_min(
self.NIGHT_END,
8 * 60
)
self.night_mode = false
self.last_night_mode = nil
end
# CONVERT HH:MM TO MINUTES
def parse_min(txt, dflt)
var m = re.search(
"(\\d\\d?):(\\d\\d)",
str(txt)
)
if m == nil
return dflt
end
var v = num(m[1], 0) * 60 + num(m[2], 0)
if v >= 0 && v < 1440
return v
end
return dflt
end
# UPDATE NIGHT MODE
def update_night_mode()
var night = false
var hr = num(hour(), -1)
var mi = num(minute(), -1)
if hr < 0 || mi < 0
return
end
if self.NIGHT_MODE_ENABLED
var now = hr * 60 + mi
# Same start and end = disabled.
if self.night_start_m == self.night_end_m
night = false
# Normal interval.
elif self.night_start_m < self.night_end_m
if now >= self.night_start_m &&
now < self.night_end_m
night = true
end
# Interval crosses midnight.
else
if now >= self.night_start_m ||
now < self.night_end_m
night = true
end
end
end
self.night_mode = night
# APPLY SETTINGS ONLY WHEN MODE CHANGES
if self.night_mode != self.last_night_mode
self.last_night_mode = self.night_mode
# NIGHT MODE
if self.night_mode
settings.set(
"brightness",
self.NIGHT_BRIGHTNESS
)
settings.set(
"autoBrightness",
self.NIGHT_AUTO_BRIGHTNESS
)
if self.NIGHT_ROTATION_ENABLED
rotation.show()
rotation.pause()
end
# DAY MODE
else
settings.set(
"brightness",
self.DAY_BRIGHTNESS
)
settings.set(
"autoBrightness",
self.DAY_AUTO_BRIGHTNESS
)
if self.NIGHT_ROTATION_ENABLED
rotation.resume()
end
end
end
# Keep rotation disabled throughout night.
if self.night_mode
if self.NIGHT_ROTATION_ENABLED
rotation.pause()
end
end
end
# MAIN LOOP
def loop()
self.update_night_mode()
end
# GET CURRENT CLOCK COLOR
def get_color()
var c = self.CLOCK_COLOR
if self.night_mode
c = self.NIGHT_CLOCK_COLOR
end
return c
end
# DRAW CLOCK
def draw()
clear()
var h = num(hour(), 0)
var m = num(minute(), 0)
var s = num(second(), 0)
# 12 / 24 HOUR FORMAT
#
# IMPORTANT:
# hour_format from SELECT is handled as a STRING.
#
# "24" = 24-hour format
# "12" = 12-hour format
if self.HOUR_FORMAT == "12"
h = h % 12
if h == 0
h = 12
end
end
# FORMAT HOURS
var hh = str(h)
if h < 10
hh = "0" + hh
end
# FORMAT MINUTES
var mm = str(m)
if m < 10
mm = "0" + mm
end
# FORMAT SECONDS
var ss = str(s)
if s < 10
ss = "0" + ss
end
# CREATE TIME STRING
var value = hh + ":" + mm
# ADD SECONDS
if self.SHOW_SECONDS
value = value + ":" + ss
end
# BLINK COLON
if self.BLINK_COLON
if s % 2 == 1
value = hh + " " + mm
if self.SHOW_SECONDS
value = value + " " + ss
end
end
end
# CENTER TEXT
var color = self.get_color()
var w = text_ink_width(value)
var x = int((width() - w) / 2)
text(
x,
6,
value,
color
)
end
# BUTTON
def on_button(btn)
end
end
return Clock()
Install it on your AWTRIX NG
Your browser writes the script straight to the device on your network. It joins the app rotation right away.
Some browsers refuse to talk to a device on your network from a public page. Download the flow and paste it into the Scripts tab of your device, or install it from a terminal:
More flows for AWTRIX NG Scripts or Miscellaneous
Something wrong with this flow? Report it.