Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

average of colour

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a JWindow which serves as a note background. I am using a palette of colours for the background that range from black to white. I need to calculate the colour average so as to choose whether white of black text is to be used over the background. So if the background is black, white text will be used.

Right now I am using a very archaic way of doing this by having an array list of named colours fill up at program startup. I chose all dark colours for the list, or the ones on which white text would be visible. Depending on the colour chosen by the user, white or black text is selected.



 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this thread would sit better on the Swing forum . . . moving.
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You had a question?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic