开发者

Color Converter

I have an ASP.Net application that uses hex number to define the colors that appears on the pages. it would be useful to find a tool where your enter the hex color and it would display the colo开发者_JS百科r. That would allow me to find out, for example what code is causing my page to be light blue.


You can use this tool to convert hex color and preview it as well.

http://easycalculation.com/color-coder.php


Well, most photo-editing tools do that. If you do graphics for your web application then use Paint.NET or something similar, which has a hex field in the Colors window. If you don't want to do either of those things, you can also edit styles dynamically in lots of browsers, Chrome and Safari have it built-in, IE has F12 Developer Tools that aren't quite as good but still do the job, and Firefox has Firebug and the Error Console too, I suppose.

Averse to all those? Write a .NET program that does it for you. Something like:

Private Sub SetColor(ByVal hexColor As String)
    Me.pnlResult.BackColor = Color.FromArgb(&HFF000000 Or Convert.ToInt32(hexColor.TrimStart("#"c), 16))
End Sub


You should be do that using something like this:

<asp:TextBox ID="txtHex" runat="server" />

<asp:Button ID="btnDisplayColor" runat="server" Text="Display Color" OnClick="btnDisplayColor_Click" />

<asp:Panel ID="pnlHexColorDisplay" runat="server" Width="30px" Height="30px" />

And for the click event of the button:

protected void btnDisplayColor_Click(object sender, EventArgs e)
{
    pnlHexColorDisplay.BackColor = System.Drawing.ColorTranslator.FromHtml(txtHex.Text.Trim());
}


EyeDropper extension for Chrome is invaluable. Input Hex or RGB values to get your color, or pick from the colorwheel, or grab a color right from your page with the eye dropper.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜