Esempio n. 1
0
 public ThemePalette Use(ThemePalette other)
 {
     this.name = other.name;
     this.path = other.path;
     this.colors.Clear();
     foreach (var group in other.colors)
     {
         foreach (var color in group.Value)
         {
             this.colors.AddNew(group.Key)[color.Key] = other.colors[group.Key][color.Key].Copy();
         }
     }
     return(this);
 }
Esempio n. 2
0
 public Theme Use(Theme other)
 {
     this.UseVariables(other, typeof(InternalAttribute).AsList());
     if (this.name.IsEmpty())
     {
         this.name = other.name;
     }
     if (this.path.IsEmpty())
     {
         this.path = other.path;
     }
     this.skinset = other.skinset;
     this.iconset = other.iconset;
     this.palette = other.palette;
     this.fontset = other.fontset;
     return(this);
 }
Esempio n. 3
0
 public void Deserialize(string data)
 {
     foreach (var line in data.GetLines())
     {
         if (line.Trim().IsEmpty())
         {
             continue;
         }
         var term  = line.Parse("", " ").Trim();
         var value = line.Parse(" ").Trim().Trim("=").Trim();
         if (term.Matches("CustomizablePalette", true))
         {
             this.customizablePalette = value.ToBool();
         }
         else if (term.Matches("CustomizableFontset", true))
         {
             this.customizableFontset = value.ToBool();
         }
         else if (term.Matches("CustomizableIconset", true))
         {
             this.customizableIconset = value.ToBool();
         }
         else if (term.Matches("Palette", true))
         {
             this.palette = ThemePalette.all.Find(x => x.name == value) ?? new ThemePalette();
         }
         else if (term.Matches("Fontset", true))
         {
             this.fontset = ThemeFontset.all.Find(x => x.name == value) ?? new ThemeFontset();
         }
         else if (term.Matches("Iconset", true))
         {
             this.iconset = ThemeIconset.all.Find(x => x.name == value) ?? new ThemeIconset();
         }
         else if (term.Matches("Skinset", true))
         {
             var variants = value.Split("+");
             this.defaultVariants = variants.Skip(1).ToArray();
             this.skinset         = ThemeSkinset.all.Find(x => x.name == variants[0]) ?? new ThemeSkinset();
         }
     }
 }
Esempio n. 4
0
 public bool Matches(ThemePalette other)
 {
     foreach (var item in this.colors["*"])
     {
         var name = item.Key;
         if (!other.colors["*"].ContainsKey(name))
         {
             return(false);
         }
         var  colorA           = this.colors["*"][name];
         var  colorB           = other.colors["*"][name];
         var  isBlended        = colorA.blendMode != ColorBlend.Normal;
         var  isSystem         = colorA.source == RelativeColor.system;
         bool mismatchedValue  = !isSystem && !isBlended && (colorA.value != colorB.value);
         bool mismatchedBlend  = isBlended && (colorA.blendMode.ToInt() != colorB.blendMode.ToInt());
         bool mismatchedOffset = colorA.offset != colorB.offset;
         bool mismatchedSource = colorA.sourceName != colorB.sourceName;
         if (mismatchedBlend || mismatchedValue || mismatchedSource || mismatchedOffset)
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 5
0
        public void Assign(ThemePalette palette, string sourceName)
        {
            var source = sourceName == "@System" ? RelativeColor.system : palette.colors["*"][sourceName];

            this.Assign(source);
        }