github.com/oweisse/u-root@v0.0.0-20181109060735-d005ad25fef1/cmds/elvish/edit/highlight/style.go (about)

     1  package highlight
     2  
     3  import (
     4  	"github.com/u-root/u-root/cmds/elvish/edit/ui"
     5  	"github.com/u-root/u-root/cmds/elvish/parse"
     6  )
     7  
     8  // Semantically applied styles.
     9  var (
    10  	styleForGoodCommand  = ui.Styles{"green"}
    11  	styleForBadCommand   = ui.Styles{"red"}
    12  	styleForGoodVariable = ui.Styles{"magenta"}
    13  )
    14  
    15  // Lexically applied styles.
    16  
    17  // ui.Styles for Primary nodes.
    18  var styleForPrimary = map[parse.PrimaryType]ui.Styles{
    19  	parse.Bareword:     {},
    20  	parse.SingleQuoted: {"yellow"},
    21  	parse.DoubleQuoted: {"yellow"},
    22  	parse.Variable:     styleForGoodVariable,
    23  	parse.Wildcard:     {},
    24  	parse.Tilde:        {},
    25  }
    26  
    27  var styleForComment = ui.Styles{"cyan"}
    28  
    29  // ui.Styles for Sep nodes.
    30  var styleForSep = map[string]string{
    31  	">":  "green",
    32  	">>": "green",
    33  	"<":  "green",
    34  	"?>": "green",
    35  	"|":  "green",
    36  
    37  	"(":  "bold",
    38  	")":  "bold",
    39  
    40  	"&": "bold",
    41  
    42  }