示例#1
0
        public ColourProvider()
        {
            var swatches = new SwatchesProvider()
                           .Swatches.Where(s => s.IsAccented).ToArray();

            var orders = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);

            _order.Select((str, idx) => new { str, idx })

            .ForEach(x => orders[x.str] = x.idx);

            Hues = swatches
                   .OrderBy(x => orders.Lookup(x.Name).ValueOr(() => 100))
                   .SelectMany(swatch =>
            {
                return(swatch.AccentHues.Select(hue => new Hue(swatch.Name, hue.Name, hue.Foreground, hue.Color)));
            })
                   .ToArray();

            DefaultHighlight = Hues
                               .Last(s => s.Swatch.Equals("amber", StringComparison.OrdinalIgnoreCase));
        }
示例#2
0
 public DisplayText(DisplayText displayText, string text)
 {
     Text      = text;
     Highlight = displayText.Highlight;
     Hue       = displayText.Hue;
 }
示例#3
0
 public DisplayText(MatchedString matchedString)
 {
     Text      = matchedString.Part;
     Highlight = matchedString.IsMatch;
     Hue       = matchedString.Hue;
 }