Time is displayed as a hex colour (or 'color' if you prefer the incorrect American spelling) |
REM Hex colour clock
REM T Street
REM 2015-03-22
REM based on idea by http://whatcolourisit.scn9a.org/
MODE 10: OFF
PROC_preventResize
COLOUR 2, 180,180,180
REPEAT
REM get the current time
a$ = RIGHT$(TIME$,8)
REM find hexidecimal rgb
r$ = MID$(a$, 1, 2)
g$ = MID$(a$, 4, 2)
b$ = MID$(a$, 7, 2)
REM find denary colour value
red% = VALLEFT$(r$,1)*16 + VALRIGHT$(r$,1)
green% = VALLEFT$(g$,1)*16 + VALRIGHT$(g$,1)
blue% = VALLEFT$(b$,1)*16 + VALRIGHT$(b$,1)
REM clear the screen to required colour
COLOUR 1, red%, green%, blue%
COLOUR 1+128:CLS
REM display time
COLOUR 2
*font Arial, 16b
PRINTTAB(30,6)"The time is"
*font Arial, 60b
PRINTTAB(05,2)r$":"g$":"b$
*font Arial, 32b
PRINTTAB(07,7)"The colour is #"r$g$b$
REM wait a mo'
OSCLI "refresh"
WAIT 100
OSCLI "refresh off"
UNTIL FALSE
DEF PROC_preventResize
REM prevent user resizing window
PRIVATE ws%
SYS "GetWindowLong", @hwnd%, -16 TO ws%
REM prevent user maximising window
SYS "SetWindowLong", @hwnd%, -16, ws% AND NOT &50000
ENDPROC
#hexadecimal