Convert Color

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Qommal
    New Member
    • Nov 2008
    • 1

    Convert Color

    How i can Convert ARGB Color in vb.net to web Color For Html Pages?
  • lotus18
    Contributor
    • Nov 2007
    • 865

    #2
    I think you cannot convert the colors in from argb to web colors. Web colors as seen on the property pallete of the IDE are constant.

    If you want to set the color, try this:

    Code:
    Color.FromName("ControlText")
    ControlText here is the color : )


    Rey Sean

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Well webpage use "#RRGGBB" as the format of their colors(as hex) so you could certainly do like:
      Color.Red.ToArg b().ToString("X 6"));

      And use that string for your webpage color

      Comment

      • balabaster
        Recognized Expert Contributor
        • Mar 2007
        • 798

        #4
        Not sure why you're trying to convert colors to "web safe" - I just finished reading a rather interesting article regarding colors on the web:



        Is it really necessary? Just wondering...

        If it is, then the simplest way would be to perform some basic math on the Hex triplet to find the closest mathematical match. I can't imagine it would be too difficult - it's just numbers after all. I don't think alpha is part of the web-safe specification for colors though so you'd have to ignore that.

        Comment

        Working...