示例#1
0
        public void checkForDefaultColors()
        {
            var bgc = backgroundColor;

            if (bgc == null)
            {
                backgroundColor = cave.Color.white();
            }
            var hbg = headerBackgroundColor;

            if (hbg == null)
            {
                headerBackgroundColor = cave.Color.black();
            }
            var htc = headerTextColor;

            if (htc == null)
            {
                if (headerBackgroundColor.isDarkColor())
                {
                    headerTextColor = cave.Color.white();
                }
                else
                {
                    headerTextColor = cave.Color.black();
                }
            }
            var mtc = messageTextColor;

            if (mtc == null)
            {
                if (backgroundColor.isDarkColor())
                {
                    messageTextColor = cave.Color.white();
                }
                else
                {
                    messageTextColor = cave.Color.black();
                }
            }
        }
示例#2
0
        public cave.Color getAdjustedForegroundColor(cave.ui.FormDeclaration.Element element, cave.Color backgroundColor)
        {
            var v = getForegroundColorForElement(element);

            if (v != null)
            {
                return(v);
            }
            if (!(backgroundColor != null))
            {
                return(cave.Color.black());
            }
            if (backgroundColor.isWhite())
            {
                return(cave.Color.forRGB(100, 100, 100));
            }
            if (backgroundColor.isDarkColor())
            {
                return(cave.Color.white());
            }
            return(cave.Color.black());
        }