todays color algo

gui
Felix Pankratz 3 years ago
parent ab8ab6f4fe
commit 50603f3a84

@ -15,11 +15,26 @@ WAVE_OFFSET = 0 - (math.pi/4)#-1.9
AMPLITUDE = 50
# only 1 color with shades?
MONOCHROME = True
# works only if monochrome is set - uses todays date as base for the color
DATE_BASED_COLOR = True
# background black? White otherwise:
DARK_BG = True
# precision of the calculation
PRECISION = 10000
def todays_color():
import datetime
import colorsys
import calendar
# a day between 1 and 365 (inclusive)
today = datetime.datetime.now().timetuple().tm_yday
year = datetime.datetime.now().year
days_in_year = 365 + calendar.isleap(year)
# between 0 and 1, how far through the year are we?
progress = today/days_in_year
return colorsys.hsv_to_rgb(progress, 1, 1)
def main():
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)

Loading…
Cancel
Save