Results 1 to 5 of 5

Thread: HTML color picker

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    California
    Posts
    115

    Post

    Is there a way to use the color picker that comes with the microsoft common dialog control to get html color codes? Or something else that I could look at so a user could click on a color and get a html color code from it?

    Thanks in advanced.

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    you need to convert the number to hex code
    like black RGB(0,0,0) is 000000 and white RGB{255,255,255) is FFFFFF

    ------------------
    DiGiTaIErRoR

  3. #3
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    Be careful that HTML uses RGB convention (Red, Green, Blue) but VB uses BGR (Blue, Green, Red)

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Post

    Here's a function you can try:

    Public Function RGBHexColor(lngColor As Long) As String
    Dim sHex As String
    sHex = Hex(lngColor)
    sHex = Right$("000000" & sHex, 6)
    sHex = Right$(sHex, 2) & Mid$(sHex, 3, 2) & Left$(sHex, 2)
    RGBHexColor = sHex
    End Function

    Just call this function and pass the color the CommonDialog returns.

    Good luck!

    ------------------
    Joacim Andersson
    joacim@programmer.net
    joacim@yellowblazer.com
    www.YellowBlazer.com



  5. #5
    Hyperactive Member
    Join Date
    Sep 1999
    Location
    Leeds, UK
    Posts
    287

    Post

    Hi Ryan,

    I made a program to help me with hex colours. You can download it here:
    http://members.xoom.com/rino_2/HexColour.zip

    I hope you like it.

    ------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width