mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge pull request #612 from wtfutil/WTF-611-gcal-color-highlighting
WTF-611 Fix gCal color highlighting
This commit is contained in:
commit
7fed7577ea
@ -171,7 +171,7 @@ func (widget *Widget) timeUntil(calEvent *CalEvent) string {
|
|||||||
func (widget *Widget) titleColor(calEvent *CalEvent) string {
|
func (widget *Widget) titleColor(calEvent *CalEvent) string {
|
||||||
color := widget.settings.colors.title
|
color := widget.settings.colors.title
|
||||||
|
|
||||||
for _, untypedArr := range widget.settings.highlights {
|
for _, untypedArr := range widget.settings.colors.highlights {
|
||||||
highlightElements := utils.ToStrs(untypedArr.([]interface{}))
|
highlightElements := utils.ToStrs(untypedArr.([]interface{}))
|
||||||
|
|
||||||
match, _ := regexp.MatchString(
|
match, _ := regexp.MatchString(
|
||||||
|
@ -16,6 +16,7 @@ type colors struct {
|
|||||||
highlights []interface{} `help:"A list of arrays that define a regular expression pattern and a color. If a calendar event title matches a regular expression, the title will be drawn in that colour. Over-rides the default title colour." values:"An array of a valid regular expression, any X11 color name." optional:"true"`
|
highlights []interface{} `help:"A list of arrays that define a regular expression pattern and a color. If a calendar event title matches a regular expression, the title will be drawn in that colour. Over-rides the default title colour." values:"An array of a valid regular expression, any X11 color name." optional:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Settings defines the configuration options for this module
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
colors
|
colors
|
||||||
common *cfg.Common
|
common *cfg.Common
|
||||||
@ -26,13 +27,14 @@ type Settings struct {
|
|||||||
email string `help:"The email address associated with your Google account. Necessary for determining 'responseStatus'." values:"A valid email address string."`
|
email string `help:"The email address associated with your Google account. Necessary for determining 'responseStatus'." values:"A valid email address string."`
|
||||||
eventCount int `help:"The number of calendar events to display." values:"A positive integer, 0..n." optional:"true"`
|
eventCount int `help:"The number of calendar events to display." values:"A positive integer, 0..n." optional:"true"`
|
||||||
multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:"true"`
|
multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:"true"`
|
||||||
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
||||||
showDeclined bool `help:"Whether or not to display events you’ve declined to attend." values:"true or false" optional:"true"`
|
showDeclined bool `help:"Whether or not to display events you’ve declined to attend." values:"true or false" optional:"true"`
|
||||||
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
|
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
|
||||||
timezone string `help:"The time zone used to display calendar event times." values:"A valid TZ database time zone string" optional:"true"`
|
timezone string `help:"The time zone used to display calendar event times." values:"A valid TZ database time zone string" optional:"true"`
|
||||||
calendarReadLevel string `help:"The calender read level specifies level you want to read events. Default: writer " values:"reader, writer", optional: "true"`
|
calendarReadLevel string `help:"The calender read level specifies level you want to read events. Default: writer " values:"reader, writer" optional:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSettingsFromYAML creates and returns an instance of Settings with configuration options populated
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
|
|
||||||
settings := Settings{
|
settings := Settings{
|
||||||
@ -53,6 +55,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
|
|
||||||
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
|
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
|
||||||
settings.colors.description = ymlConfig.UString("colors.description", "white")
|
settings.colors.description = ymlConfig.UString("colors.description", "white")
|
||||||
|
settings.colors.highlights = ymlConfig.UList("colors.highlights")
|
||||||
settings.colors.past = ymlConfig.UString("colors.past", "gray")
|
settings.colors.past = ymlConfig.UString("colors.past", "gray")
|
||||||
settings.colors.title = ymlConfig.UString("colors.title", "white")
|
settings.colors.title = ymlConfig.UString("colors.title", "white")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user