how does the "BackColor" Long Integer work?

white = 16777215
pink = 13027071
blue = 15977088

(or there abouts)

what i'm asking is, if i want to tweek the shade a little, what's the logic?

i thought it might be RRR GGG BBB but (besides there not being 9 digits) i've been playing with it, and i can't determine any rhyme to it.

for the points, please tell me what digits control what aspects of the color (or a good web site where this information can be found)

thanks,
mac

LVL 4
MacRenaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dqmqCommented:
Here's the color constants (in hex) which I believe are additive.  


vbRed         0x0000FF       Red
vbGreen      0x00FF00       Green
vbBlue        0xFF0000       Blue


For example, to Yellow = Red + Green = 0x0000FF + 0x00FF00 = 0x00FFFF

To get less red, subtract n *  (2 ^ 0)  where n = 1 to 255
To get less green, subtract n * (2 ^ 8) where n = 1 to 255
To get less blue, subtract n * (2 ^ 16) where n = 1 to 255

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
harfangCommented:
If you want to tweak the colors, use the built-in RGB() function:

    RGB(255,255,255) = 16777215 (white)
    RGB(0,0,255) = 16711680 (blue)
    RGB(255,0,0) = 255 (red)

If you are familiar with Hex notation, you can go:

    .BackColor = &HFFFFFF& (white)
    .BackColor = &H00FF00& (green)
    .BackColor = &H0000FF& (red)

Note however that the VB colors are coded "BGR" (as explained by dqmg) with red = &HFF, unlike the "internet colors" coded "RGB" with red = 0xff0000

And you can also just click the builder button on any "color" property, pick your color in the dialog box and then remember the numeric  value.

Good luck!
(°v°)
thenelsonCommented:
And you will find a great free tool for tweaking colors (and other things) here:
http://personales.conexion.com.py/sgrillo/
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Gustav BrockCIOCommented:
Here's how to extract the discrete colours:

Public Sub CompositeRGB( _
  ByVal lngRGB As Long, _
  ByRef intRed As Integer, _
  ByRef intGreen As Integer, _
  ByRef intBlue As Integer)
 
' Calculate discrete RGB colours from composite colour value.
'
' 1999-08-20. Cactus Data ApS, CPH
 
  If lngRGB < 0 Then
    ' Nothing to do.
    intRed = 0
    intGreen = 0
    intBlue = 0
  Else
    ' Dissolve composite RGB into discrete colours.
    intRed = lngRGB And vbRed
    intGreen = (lngRGB And vbGreen) / &H100
    intBlue = (lngRGB And vbBlue) / &H10000
  End If
  Debug.Print intRed, intGreen, intBlue

End Sub
MacRenaAuthor Commented:
thanks everyone.
hmmm, 50 points won't go far.  increasing to split
mac
harfangCommented:
It was kind of you to increase points and to aknowledge all contributions. Thanks!
(°v°)
thenelsonCommented:
You're welcome.  Glad to help and thank you very much for the points with "A" grade!  Thanks for the split.

Happy Computing!

Nelson
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.