1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

modules/gcal: Add property colors.eventTime

This will let the user set a fixed color for the event time
irrespective of colors used in highlights.
This commit is contained in:
Indradhanush Gupta 2019-09-18 01:21:29 +05:30
parent 4c3abf5aca
commit 1ce29f4930

View File

@ -10,6 +10,7 @@ const defaultTitle = "Calendar"
type colors struct {
day string
description string `help:"The default color for calendar event descriptions." values:"Any X11 color name." optional:"true"`
eventTime string `help:"The default color for calendar event times." values:"Any X11 color name." optional:"true"`
past string `help:"The color for calendar events that have passed." values:"Any X11 color name." optional:"true"`
title string `help:"The default colour for calendar event titles." values:"Any X11 color name." optional:"true"`
@ -55,6 +56,14 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
settings.colors.description = ymlConfig.UString("colors.description", "white")
// settings.colors.eventTime is a new feature introduced via issue #638. Prior to this, the color of the event
// time was (unintentionally) customized via settings.colors.description. To maintain backwards compatibility
// for users who might be already using this to set the color of the event time, we try to determine the default
// from settings.colors.description. If it is not set, then the default value of "white" is used. Finally, if a
// user sets a value for colors.eventTime, it overrides the defaults.
//
// PS: We should have a deprecation plan for supporting this backwards compatibility feature.
settings.colors.eventTime = ymlConfig.UString("colors.eventTime", settings.colors.description)
settings.colors.highlights = ymlConfig.UList("colors.highlights")
settings.colors.past = ymlConfig.UString("colors.past", "gray")
settings.colors.title = ymlConfig.UString("colors.title", "white")