// Get a style entry. Will try sub-category or category if an exact match is not found, and
// finally return the Background.
497211
func (s *Style) Get(ttype TokenType) StyleEntry {
	return s.get(ttype).Inherit(
		s.get(Background),
		s.get(Text),
		s.get(ttype.Category()),
		s.get(ttype.SubCategory()))
}
294825
func (r Resources) GetMatch(pattern string) Resource {
	g, err := internal.GetGlob(pattern)
	if err != nil {
		return nil
	}

	for _, resource := range r {
		if g.Match(strings.ToLower(resource.Name())) {
			return resource
		}
	}

	return nil
}
733744
func (s *SkipList) Get(key interface{}) (value interface{}, ok bool) {
	candidate := s.getPath(s.header, nil, key)

	if candidate == nil || candidate.key != key {
		return nil, false
	}

	return candidate.value, true
}
709783
func (sbc StackedBarChart) GetFont() *truetype.Font {
	if sbc.Font == nil {
		return sbc.defaultFont
	}
	return sbc.Font
}
973122
func (r *Store) GetEntry(key string) (Entry, bool) {
	args := *r
	n := len(args)
	for i := 0; i < n; i++ {
		if kv := args[i]; kv.Key == key {
			return kv, true
		}
	}

	return emptyEntry, false
}
970060
func ParseStyleEntry(entry string) (StyleEntry, error) { // nolint: gocyclo
	out := StyleEntry{}
	parts := strings.Fields(entry)
	for _, part := range parts {
		switch {
		case part == "italic":
			out.Italic = Yes
		case part == "noitalic":
			out.Italic = No
		case part == "bold":
			out.Bold = Yes
		case part == "nobold":
			out.Bold = No
		case part == "underline":
			out.Underline = Yes
		case part == "nounderline":
			out.Underline = No
		case part == "inherit":
			out.NoInherit = false
		case part == "noinherit":
			out.NoInherit = true
		case part == "bg:":
			out.Background = 0
		case strings.HasPrefix(part, "bg:#"):
			out.Background = ParseColour(part[3:])
			if !out.Background.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid background colour %q", part)
			}
		case strings.HasPrefix(part, "border:#"):
			out.Border = ParseColour(part[7:])
			if !out.Border.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid border colour %q", part)
			}
		case strings.HasPrefix(part, "#"):
			out.Colour = ParseColour(part)
			if !out.Colour.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid colour %q", part)
			}
		default:
			return StyleEntry{}, fmt.Errorf("unknown style element %q", part)
		}
	}
	return out, nil
}
262133
func (s Style) GetTextVerticalAlign(defaults ...TextVerticalAlign) TextVerticalAlign {
	if s.TextVerticalAlign == TextVerticalAlignUnset {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return TextVerticalAlignUnset
	}
	return s.TextVerticalAlign
}
438778
func (s Style) GetDotOptions() Style {
	return Style{
		ClassName:       s.ClassName,
		StrokeDashArray: nil,
		FillColor:       s.DotColor,
		StrokeColor:     s.DotColor,
		StrokeWidth:     1.0,
	}
}
1102954
func (s Style) GetDotColor(defaults ...drawing.Color) drawing.Color {
	if s.DotColor.IsZero() {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return drawing.ColorTransparent
	}
	return s.DotColor
}
222979
func (c *LRU) Get(key interface{}) (value interface{}, ok bool) {
	if ent, ok := c.items[key]; ok {
		c.evictList.MoveToFront(ent)
		return ent.Value.(*entry).value, true
	}
	return
}
835121
func (s Style) WithBackground(color Paint) Style {
	newS := s
	newS.bg = color
	newS.code = computeColorCode(newS.bg, newS.fg)
	return newS
}
1312581
func (obj *Global) GetAppEntry(ctx context.Context, appID string) (*AppEntry, error) {
	result := &struct {
		Entry *AppEntry	`json:"qEntry"`
	} {}
	err := obj.rpc(ctx, "GetAppEntry", result, appID)
	return result.Entry, err 
}
1090132
func NewStyle(name, val string) *Style {
	s := Style{Name: name, Value: val}
	return &s
}
554119
func (s Style) GetPadding(defaults ...Box) Box {
	if s.Padding.IsZero() {
		if len(defaults) > 0 {
			return defaults[0]
		}
		return Box{}
	}
	return s.Padding
}
1194519
func (inliner *Inliner) insertRawStylesheet() {
	rawCSS := inliner.computeRawCSS()
	if rawCSS != "" {
		// create <style> element
		cssNode := &html.Node{
			Type: html.TextNode,
			Data: "\n" + rawCSS,
		}

		styleNode := &html.Node{
			Type: html.ElementNode,
			Data: "style",
			Attr: []html.Attribute{{Key: "type", Val: "text/css"}},
		}

		styleNode.AppendChild(cssNode)

		// append to <head> element
		headNode := inliner.doc.Find("head")
		if headNode == nil {
			// @todo Create head node !
			panic("NOT IMPLEMENTED: create missing <head> node")
		}

		headNode.AppendNodes(styleNode)
	}
}
1111328
func GetContext(ctx context.Context) context.Context {
	if ctx != nil {
		return ctx
	}
	return context.Background()
}
173165
func (obj *Global) GetAppEntryRaw(ctx context.Context, appID string) (json.RawMessage, error) {
	result := &struct {
		Entry json.RawMessage	`json:"qEntry"`
	} {}
	err := obj.rpc(ctx, "GetAppEntry", result, ensureEncodable(appID))
	return result.Entry, err 
}