Exemplo n.º 1
0
        private void HiLiteRow(GridViewRow row)
        {
            if (DoHiLiteRow)
            {
                // Change cursor to hand
                row.Style["cursor"] = "pointer";

                // The 50% color of the background
                Color BackColorLight = Color.Empty;
                Color BackColor      = Color.Empty;

                // Get the back color
                BackColor = ((row.RowState == DataControlRowState.Alternate)
                                 ? AlternatingRowStyle.BackColor
                                 : RowStyle.BackColor);
                // Generate a light version
                BackColorLight = RGBHSL.ModifyBrightness(BackColor, .8);

                // Add the mouse over and mouse out javascript events here
                row.Attributes.Add("onmouseover",
                                   "javascript:this.style.backgroundColor = '" + ColorTranslator.ToHtml(BackColorLight) +
                                   "';");
                row.Attributes.Add("onmouseout",
                                   "javascript:this.style.backgroundColor = '" + ColorTranslator.ToHtml(BackColor) +
                                   "';");

                //set up the post back for a row when it is clicked
                row.Attributes.Add("onclick",
                                   Page.ClientScript.GetPostBackEventReference(this, "Select$" + row.RowIndex.ToString()));
            }
        }
Exemplo n.º 2
0
        public Color BrightenColor(EliteAPI.ChatEntry chatLine)
        {
            Color brighterColor = new Color();
            //how many steps away can the colors be away from each other to be close enough to grayscale
            //this variable's value is subjective, and chosen by the programmer
            int steps = 3;
            //tolerance = 256 colors / 64 in-game 'step' choices * steps
            int tolerance     = 256 / 64 * steps;
            int closeEnoughRG = Math.Abs(chatLine.ChatColor.R - chatLine.ChatColor.G);
            int closeEnoughGB = Math.Abs(chatLine.ChatColor.G - chatLine.ChatColor.B);
            int closeEnoughRB = Math.Abs(chatLine.ChatColor.R - chatLine.ChatColor.B);

            if ((closeEnoughRG <= tolerance) && (closeEnoughGB <= tolerance) && (closeEnoughRB <= tolerance))
            {
                //greatly brighten white and gray text
                brighterColor = RGBHSL.ModifyBrightness(chatLine.ChatColor, 1.85);
            }
            else
            {
                //only slighty brighten color text
                brighterColor = RGBHSL.ModifyBrightness(chatLine.ChatColor, 1.25);
            }

            return(brighterColor);
        }