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 {
 | 
			
		||||
	color := widget.settings.colors.title
 | 
			
		||||
 | 
			
		||||
	for _, untypedArr := range widget.settings.highlights {
 | 
			
		||||
	for _, untypedArr := range widget.settings.colors.highlights {
 | 
			
		||||
		highlightElements := utils.ToStrs(untypedArr.([]interface{}))
 | 
			
		||||
 | 
			
		||||
		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"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Settings defines the configuration options for this module
 | 
			
		||||
type Settings struct {
 | 
			
		||||
	colors
 | 
			
		||||
	common *cfg.Common
 | 
			
		||||
@ -30,9 +31,10 @@ type Settings struct {
 | 
			
		||||
	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"`
 | 
			
		||||
	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 {
 | 
			
		||||
 | 
			
		||||
	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.description = ymlConfig.UString("colors.description", "white")
 | 
			
		||||
	settings.colors.highlights = ymlConfig.UList("colors.highlights")
 | 
			
		||||
	settings.colors.past = ymlConfig.UString("colors.past", "gray")
 | 
			
		||||
	settings.colors.title = ymlConfig.UString("colors.title", "white")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user