Results 1 to 4 of 4

Thread: Function for hex to rgb?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Post

    I need a function that will return the R, G, And B Values from a hexidecimal color. Is there a function to do this? If not could someone possibly share some code to do this? I would be wickid happy if you could.
    Thanks
    joey o

  2. #2
    Guest

    Post

    Email me.. I got a tool that you need..



    ------------------
    John T. Mieske
    Star Trek LCARS programmer

    Knight Vision Enterprises
    [email protected]

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Post

    Public Function ColorCodeToRGB(lColorCode As Long, iRed As Integer, iGreen As Integer, iBlue As Integer) As Boolean
    ' 1996/01/16 Return the individual colors for lColorCode.
    ' 1996/07/15 Use Tip 171: Determining RGB Color Values, MSDN July 1996.
    ' Enter with:
    ' lColorCode contains the color to be converted
    '
    ' Return:
    ' iRed contains the red component
    ' iGreen the green component
    ' iBlue the blue component
    '
    Dim lColor As Long
    lColor = lColorCode 'work long
    iRed = lColor Mod &H100 'get red component
    lColor = lColor \ &H100 'divide
    iGreen = lColor Mod &H100 'get green component
    lColor = lColor \ &H100 'divide
    iBlue = lColor Mod &H100 'get blue component

    ColorCodeToRGB = True
    End Function



  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Post

    Thanks Paul282!
    That's some really cool code. I'm very greatful.
    Thanks Again
    Joey o.

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