isDarkMode
isDarkMode returns whether the desktop is currently in dark mode.
Signature
isDarkMode(): booleantyrus
import { isDarkMode } from "tyrus:os";
const dark: boolean = isDarkMode();
print(dark ? "dark mode" : "light mode");Best effort
Relies on the platform having a queryable dark-mode setting (the Windows registry, macOS's AppleInterfaceStyle, or a Linux desktop portal/GNOME setting). Where none is reachable, a headless machine, an unsupported desktop, this conservatively returns false (light) rather than aborting the program.
