Example #1
0
            public override void initializeWidget()
            {
                base.initializeWidget();
                label = cave.ui.LabelWidget.forText(context, labeltext);
                var color = textColor;

                if (color == null)
                {
                    if (backgroundColor.isLightColor())
                    {
                        color = cave.Color.forRGB(0, 0, 0);
                    }
                    else
                    {
                        color = cave.Color.forRGB(255, 255, 255);
                    }
                }
                label.setWidgetTextColor(color);
                addWidget((Windows.UI.Xaml.UIElement)cave.ui.CanvasWidget.forColor(context, backgroundColor));
                addWidget((Windows.UI.Xaml.UIElement)cave.ui.LayerWidget.forWidget(context, (Windows.UI.Xaml.UIElement)label, context.getHeightValue("1500um")));
            }
Example #2
0
        private void updateWidgetColors()
        {
            var textColor = widgetTextColor;

            if (!(textColor != null))
            {
                if (widgetBackgroundColor != null)
                {
                    if (widgetBackgroundColor.isLightColor())
                    {
                        textColor = cave.Color.black();
                    }
                    else
                    {
                        textColor = cave.Color.white();
                    }
                }
                else
                {
                    textColor = cave.Color.black();
                }
            }
        }
Example #3
0
        public cave.Color getActualWidgetTextColor()
        {
            var textColor = widgetTextColor;

            if (textColor == null)
            {
                if (widgetBackgroundColor != null)
                {
                    if (widgetBackgroundColor.isLightColor())
                    {
                        textColor = cave.Color.black();
                    }
                    else
                    {
                        textColor = cave.Color.white();
                    }
                }
                else
                {
                    textColor = cave.Color.black();
                }
            }
            return(textColor);
        }
        private void updateWidgetColors()
        {
            var textColor = widgetTextColor;

            if (textColor == null)
            {
                if (widgetBackgroundColor != null)
                {
                    if (widgetBackgroundColor.isLightColor())
                    {
                        textColor = cave.Color.black();
                    }
                    else
                    {
                        textColor = cave.Color.white();
                    }
                }
                else
                {
                    textColor = cave.Color.black();
                }
            }
            this.Foreground = textColor.toBrush();
        }