public static bool IsWhiteText(ColourData text, ColourData foreground)
        {
            uint textColour = 0x00000000;
            uint foregroundColour = 0xFFFFFF;

            if (text.m_type == ColourType.Indexed)
            {
                textColour = ConvertColourIndex(text.m_colourValue);
            }
            else if (text.m_type == ColourType.RGB)
            {
                textColour = UInt32.Parse(text.m_colourValue, System.Globalization.NumberStyles.HexNumber);
            }

            ColorState cs = new ColorState();
            if (foreground.m_type == ColourType.Indexed)
            {
                foregroundColour = ConvertColourIndex(foreground.m_colourValue);
            }
            else if (foreground.m_type == ColourType.NotSet)
            { 
                return cs.IsWhite(textColour);
            }
            else
                foregroundColour = UInt32.Parse(foreground.m_colourValue, System.Globalization.NumberStyles.HexNumber);

            return cs.IsWhite(textColour) && cs.IsWhite(foregroundColour);
        }
        public static bool IsWhiteText(ColourData text)
        {
            uint textColour = 0x00000000;

            if (text.m_type == ColourType.Indexed)
            {
                textColour = ConvertColourIndex(text.m_colourValue);
            }
            else if (text.m_type == ColourType.RGB)
            {
                textColour = UInt32.Parse(text.m_colourValue, System.Globalization.NumberStyles.HexNumber);
            }
            ColorState cs = new ColorState();
            return cs.IsWhite(textColour);
        }
        public static bool IsRedactedText(ColourData foreground, ColourData background)
        {
            uint foregroundColour = 0xFFFFFF;
            uint backgroundColour = 0xFFFFFF;
            if (foreground.m_type == ColourType.NotSet)
            {
                foregroundColour = 0x00000000;
            }
            else if (foreground.m_type == ColourType.Indexed)
            {
                foregroundColour = ConvertColourIndex(foreground.m_colourValue);
            }
            else
                foregroundColour = UInt32.Parse(foreground.m_colourValue, System.Globalization.NumberStyles.HexNumber);

            if(background.m_type == ColourType.Indexed)
            {
                backgroundColour = ConvertColourIndex(background.m_colourValue);
            }
            else if (background.m_type == ColourType.RGB)
            {
                backgroundColour = UInt32.Parse(background.m_colourValue, System.Globalization.NumberStyles.HexNumber);
            }

            ColorState cs = new ColorState();
            return cs.IsTextInvisible(foregroundColour, backgroundColour);
        }
Exemplo n.º 4
0
 public ColorState UpdateForeground(string newColor)
 {
     ColorState result = new ColorState(this);
     if (newColor == "auto")
     {
         result.foreground = 0xFFFFFFFF;
     }
     else
     {
         result.foreground = UInt32.Parse(newColor, System.Globalization.NumberStyles.HexNumber);
     }
     return result;
 }
Exemplo n.º 5
0
 public ColorState(ColorState other)
 {
     this.foreground = other.foreground;
     this.background = other.background;
     this.highlight = other.highlight;
 }
Exemplo n.º 6
0
 public ColorState UpdateHighlight(string newColor)
 {
     ColorState result = new ColorState(this);
     result.highlight = ConvertHighlightName(newColor);
     return result;
 }