示例#1
0
文件: theme.go 项目: haofree/lime
func (t *Theme) Spice(vr *render.ViewRegions) (ret render.Flavour) {
	s := t.ClosestMatchingSetting(vr.Scope)
	ret.Foreground = render.Colour(s.Settings["foreground"])
	if bg, ok := s.Settings["background"]; ok {
		ret.Background = render.Colour(bg)
	}
	return
}
示例#2
0
文件: theme.go 项目: nadavvin/lime
func (t *Theme) Spice(vr *render.ViewRegions) (ret render.Flavour) {
	if len(t.Settings) == 0 {
		return
	}
	def := &t.Settings[0]

	s := t.ClosestMatchingSetting(vr.Scope)
	fg, ok := s.Settings["foreground"]
	if !ok {
		fg = def.Settings["foreground"]
	}
	ret.Foreground = render.Colour(fg)
	bname := "background"
	if vr.Flags&render.SELECTION != 0 {
		bname = "selection"
	}
	bg, ok := s.Settings[bname]
	if !ok {
		bg = def.Settings[bname]
	}
	ret.Background = render.Colour(bg)
	return
}