473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Color-BackColor

Given BackColor of

BGC = RGB(x,y,z)

is there a function, procedure or rule of thumb based on the values of x,y
and z

which will indicate which of black or white

is likely to stand out more as a ForeColor?

.....

If one allows colors for ForeColor "NOT RGB(x,y,z)" seems to provide
contrast for those colors which are bright or dark, but NOT grey seems to
result in something pretty close to grey.

That is Not RGB(128,128,128) = RGB(127,127,127) (actually as a long it
slams an &HFF in the 4 hole but that's irrelevant here, I think.)

I suppose there is some rule of thumb based on the value of BGC ... but
I'll see if anyone has experience with this before I annoy my household
with ... look at this combination ... which is clearer???? all day.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #1
3 3769
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4:
That is Not RGB(128,128,128) = RGB(127,127,127) (actually as a long it
slams an &HFF in the 4 hole but that's irrelevant here, I think.)


While it may be irrelevant for the purposes of this discussion, it seems
setthing the last bit in this byte transforms the rgb color to something else
.... perhaps a windows system color ... where the other values map to an index
rather than directly affecting color ... maybe this is good reason not to use
NOT.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2
Lyle Fairfield <Mi************@Invalid.Com> wrote in message news:<Xn*******************@130.133.1.4>...
Given BackColor of

BGC = RGB(x,y,z)

is there a function, procedure or rule of thumb based on the values of x,y
and z

which will indicate which of black or white

is likely to stand out more as a ForeColor?

....

If one allows colors for ForeColor "NOT RGB(x,y,z)" seems to provide
contrast for those colors which are bright or dark, but NOT grey seems to
result in something pretty close to grey.

That is Not RGB(128,128,128) = RGB(127,127,127) (actually as a long it
slams an &HFF in the 4 hole but that's irrelevant here, I think.)

I suppose there is some rule of thumb based on the value of BGC ... but
I'll see if anyone has experience with this before I annoy my household
with ... look at this combination ... which is clearer???? all day.

Isn't the colour value (colorref) supposed to indicate the
'brightness' of a colour? As you're not looking for an 'opposite'
colour (you said black or white) why not just go ForeColor Black for
BGC >= 8421504 which is RGB(128,128,128)and White for BGC < 8421504?
Nov 12 '05 #3
jo*******@btinternet.com (Jon Lewis) wrote in
news:3f**************************@posting.google.c om:
Lyle Fairfield <Mi************@Invalid.Com> wrote in message
news:<Xn*******************@130.133.1.4>...
Given BackColor of

BGC = RGB(x,y,z)

is there a function, procedure or rule of thumb based on the values of
x,y and z

which will indicate which of black or white

is likely to stand out more as a ForeColor?

....

If one allows colors for ForeColor "NOT RGB(x,y,z)" seems to provide
contrast for those colors which are bright or dark, but NOT grey seems
to result in something pretty close to grey.

That is Not RGB(128,128,128) = RGB(127,127,127) (actually as a long it
slams an &HFF in the 4 hole but that's irrelevant here, I think.)

I suppose there is some rule of thumb based on the value of BGC ... but
I'll see if anyone has experience with this before I annoy my household
with ... look at this combination ... which is clearer???? all day.

Isn't the colour value (colorref) supposed to indicate the
'brightness' of a colour? As you're not looking for an 'opposite'
colour (you said black or white) why not just go ForeColor Black for
BGC >= 8421504 which is RGB(128,128,128)and White for BGC < 8421504?


Well such a rule may work in practical terms and the colors may "look"
right, which, I suppose, is what we want, but the rule doesn't "look"
right, as all 128's are not equal, that is the red 128 is 128 but the green
128 is 128 * 255 = 32640 while the blue 128 is 128 * 65280 = 8355840.

My current rule of thumb is:

With r
Do While Not .EOF
c(0) = CLng("&H" & Right(!ColorRGBBytes, 6)) 'colors are stored
as # plus six hex digits
c(1) = ((c(0) And 255) / 2 ^ 0 + (c(0) And 65280) / 2 ^ 8 + (c
(0) And 16711680) / (2 ^ 16))
If c(1) < 128 Then
!ForeColorRGBBytes = "#ffffff"
Else
!ForeColorRGBBytes = "#000000"
End If
.MoveNext
Loop
.UpdateBatch
End With

which results,,in what I hope are the darkest one sixth of the colors,
having a white forecolor and the rest, black.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dan glenn | last post by:
(PHP4.3.4, GD2) How can I save a PNG using GD2 and insure that it saves as a palette-based (8-bit, 256-color) single-color transparancy?? Saving this way, I could be sure that an image loaded from...
6
by: me | last post by:
good day, i found this message: and i want to know more about it too. ========================================== Hey all, example:...
6
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black...
3
by: Richard A. DeVenezia | last post by:
I hope this is the end of my present 'discovery' phase. I've learned alot about JavaScript in a short time and my head hurts. The following is what came out of all my questions and all the...
5
by: Chris Beall | last post by:
I'm displaying an image that is also a link against a black background. In Netscape 7.1, the current background color is displayed as a horizontal bar below the image. This allows :hover effects...
4
by: bart plessers | last post by:
Hello, I am making a website where the user can choose a 'skin'. This works with asp en stylesheets. In the stylesheet, a number of tags are (re)defined. The main idea is to have a limited...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
25
by: Neal | last post by:
According to the CSS lint at http://htmlhelp.org/tools/csscheck/, "The shorthand background property is more widely supported than background-color." Can anyone point me to, or provide, information...
27
by: Kevin Yu | last post by:
When I declare on HTML page <LINK href="mycss.css" type="text/css" rel=stylesheet /> .... <BODY class=myclass> in mycss.css BODY { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY:...
7
by: Jonathan N. Little | last post by:
When doing a final check on my stylesheets the CSS Validator flag lines like this one as an error: ADDRESS A { color: gold; } Error is: # Line: 31 Context : ADDRESS A Invalid number :...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.