• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help to get client's system colour

 
Leena Diwan
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All!!

We are doing a POC currently wherein we need to get the System colours in the JSP file.
Example: If user has set a specific theme, we want to be able to get the theme details through API's on the JSP.
Based on these we want to apply colours to some custom display components.

All we are getting is AWT related classes. And that too is the server system colours and not the client's.

We need help in knowing if we can get this info by not using AWT? Is it feasible?

Thanks in advance!
Leena
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jsp's are converted to servlet and live in the container.From this you can at best get server properties ,not client properties.
If you would like to go for a complex solution then you might have to do some applet stuff to take the required information from the client system and send those to server , so that going forward server can generate views using this information.

By the way , how can you get theme properties ? Is this something set in the environment variables ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The user's system colors are not sent to the server.
To see what is sent, install either the LiveHttpHeaders or the FireBug plugin for Firefox and look at the HTTP request headers.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, none of the visual widgets provided by AWT or Swing can be used in a JSP. For that you'd need to write either Applets or a JWS project.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I wanted to let clients set color schemes I would use CSS - a technology designed for exactly this kind of customization. You might have to create a CSS selection page to let the user select the scheme they want from a stock set or do something even more complicated with javascript.

Then all your web application has to remember is which CSS to link to in each user's pages - just one line in your JSP.

Bill
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with the "use CSS' recommendation. CSS actually allows you to assign system colors to elements. For example, a color of "ButtonFace" causes the styled element to be colored as a standard system button's background would. So for example, if you were creating a small span that you wanted to look like a button, you might apply these styles (among others):

A list of said CSS system color names can be found here:
http://people.n0i.net/altblue/colors/css-system-colors.html
[ August 27, 2007: Message edited by: dave taubler ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just be aware that support for system colors in CSS is not available in all browsers. Be sure to test on all browsers that you plan to support.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic