Пример #1
0
 private XLColor(XLThemeColor themeColor) : this(new XLColorKey
 {
     ThemeColor = themeColor,
     ColorType = XLColorType.Theme
 })
 {
 }
        public void CanResolveAllThemeColors(XLThemeColor themeColor)
        {
            var theme = new XLWorkbook().Theme;
            var color = theme.ResolveThemeColor(themeColor);

            Assert.IsNotNull(color);
        }
Пример #3
0
 private XLColor(XLThemeColor themeColor, Double themeTint)
 {
     _themeColor = themeColor;
     _themeTint  = themeTint;
     _hashCode   = 7 ^ _themeColor.GetHashCode() ^ _themeTint.GetHashCode();
     HasValue    = true;
     _colorType  = XLColorType.Theme;
 }
 internal XLColor(XLThemeColor themeColor, Double themeTint)
 {
     _themeColor = themeColor;
     _themeTint = themeTint;
     _hashCode = 7 ^ _themeColor.GetHashCode() ^ _themeTint.GetHashCode();
     HasValue = true;
     _colorType = XLColorType.Theme;
 }
 internal XLColor(XLThemeColor themeColor)
 {
     _themeColor = themeColor;
     _themeTint  = 1;
     _hashCode   = 7 ^ _themeColor.GetHashCode() ^ _themeTint.GetHashCode();
     HasValue    = true;
     _colorType  = XLColorType.Theme;
 }
Пример #6
0
 private XLColor(XLThemeColor themeColor, Double themeTint) : this(new XLColorKey
 {
     ThemeColor = themeColor,
     ThemeTint = themeTint,
     ColorType = XLColorType.Theme
 })
 {
 }
Пример #7
0
 private XLColor(XLThemeColor themeColor)
 {
     _themeColor = themeColor;
     _themeTint = 0;
     _hashCode = 7 ^ _themeColor.GetHashCode() ^ _themeTint.GetHashCode();
     HasValue = true;
     _colorType = XLColorType.Theme;
 }
Пример #8
0
        public XLColor ResolveThemeColor(XLThemeColor themeColor)
        {
            var tc      = themeColor.ToString();
            var members = accessor.GetMembers();

            if (members.Any(m => m.Name.Equals(tc)))
            {
                return(accessor[this, tc] as XLColor);
            }
            else
            {
                return(null);
            }
        }
        public XLColor ResolveThemeColor(XLThemeColor themeColor)
        {
            switch (themeColor)
            {
            case XLThemeColor.Background1:
                return(Background1);

            case XLThemeColor.Text1:
                return(Text1);

            case XLThemeColor.Background2:
                return(Background2);

            case XLThemeColor.Text2:
                return(Text2);

            case XLThemeColor.Accent1:
                return(Accent1);

            case XLThemeColor.Accent2:
                return(Accent2);

            case XLThemeColor.Accent3:
                return(Accent3);

            case XLThemeColor.Accent4:
                return(Accent4);

            case XLThemeColor.Accent5:
                return(Accent5);

            case XLThemeColor.Accent6:
                return(Accent6);

            case XLThemeColor.Hyperlink:
                return(Hyperlink);

            case XLThemeColor.FollowedHyperlink:
                return(FollowedHyperlink);

            default:
                return(null);
            }
        }
Пример #10
0
        internal XLColor GetXLColor(XLThemeColor themeColor)
        {
            switch (themeColor)
            {
            case XLThemeColor.Text1:
                return(Theme.Text1);

            case XLThemeColor.Background1:
                return(Theme.Background1);

            case XLThemeColor.Text2:
                return(Theme.Text2);

            case XLThemeColor.Background2:
                return(Theme.Background2);

            case XLThemeColor.Accent1:
                return(Theme.Accent1);

            case XLThemeColor.Accent2:
                return(Theme.Accent2);

            case XLThemeColor.Accent3:
                return(Theme.Accent3);

            case XLThemeColor.Accent4:
                return(Theme.Accent4);

            case XLThemeColor.Accent5:
                return(Theme.Accent5);

            case XLThemeColor.Accent6:
                return(Theme.Accent6);

            default:
                throw new ArgumentException("Invalid theme color");
            }
        }
 public static XLColor FromTheme(XLThemeColor themeColor, Double themeTint)
 {
     return new XLColor(themeColor, themeTint);
 }
 public static XLColor FromTheme(XLThemeColor themeColor)
 {
     return new XLColor(themeColor);
 }
Пример #13
0
 internal XLColor GetXLColor(XLThemeColor themeColor)
 {
     switch (themeColor)
     {
         case XLThemeColor.Text1:
             return Theme.Text1;
         case XLThemeColor.Background1:
             return Theme.Background1;
         case XLThemeColor.Text2:
             return Theme.Text2;
         case XLThemeColor.Background2:
             return Theme.Background2;
         case XLThemeColor.Accent1:
             return Theme.Accent1;
         case XLThemeColor.Accent2:
             return Theme.Accent2;
         case XLThemeColor.Accent3:
             return Theme.Accent3;
         case XLThemeColor.Accent4:
             return Theme.Accent4;
         case XLThemeColor.Accent5:
             return Theme.Accent5;
         case XLThemeColor.Accent6:
             return Theme.Accent6;
         default:
             throw new ArgumentException("Invalid theme color");
     }
 }
Пример #14
0
        public static XLColor FromTheme(XLThemeColor themeColor, Double themeTint)
        {
            XLColor ret;
            lock (ByThemeTintLock)
            {
                Dictionary<Double, XLColor> themeTints;
                if (ByThemeTint.TryGetValue(themeColor, out themeTints))
                {
                    if (!themeTints.TryGetValue(themeTint, out ret))
                    {
                        ret = new XLColor(themeColor, themeTint);
                        themeTints.Add(themeTint, ret);
                    }
                }
                else
                {
                    themeTints = new Dictionary<double, XLColor>();
                    ret = new XLColor(themeColor, themeTint);
                    themeTints.Add(themeTint, ret);

                    ByThemeTint.Add(themeColor, themeTints);
                }
            }
            return ret;
        }
Пример #15
0
 public static XLColor FromTheme(XLThemeColor themeColor)
 {
     XLColor ret;
     lock (ByThemeLock)
     {
         if (!ByTheme.TryGetValue(themeColor, out ret))
         {
             ret = new XLColor(themeColor);
             ByTheme.Add(themeColor, ret);
         }
     }
     return ret;
 }