#1
  1. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15

    referencing system colors/fonts from css


    I'm looking for a way to reference the used system colors (and fonts) in css.

    Here's the situation: I've create some context menu's (the right-click menu's in a browser). The browser generated context menu's, say when right-clicking on a link, show you some options using a particular style: colors, fonts, padding, etc. I'd like to be able to use these already defined/installed style definitions. But how do you reference these in a stylesheet?

    I know I can use a color picker to figure out the color scheme of a default browser look. But, since a lot of people use skins or themes, I'd like to use the colors and fonts used in the active skin, to keep the context menu in line with the rest of the look and feel.

    Does anyone know a way how to read or use these particular style settings?

    Any suggestion, tip, link is appreciated.

    Jeroen
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Seattle WA
    Posts
    863
    Rep Power
    14
    You're looking for the CSS2 system colors, a collection of about two dozen keywords that describe colors defined by the user's system.

    Ref: system colors @w3c.org
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Posts
    1,014
    Rep Power
    15
    Thanks, that's the list I was looking for!

    However, it looks as if Mozilla skins/themes don't set these pre-defined colors, or use more than these. I haven't thoroughly checked it yet, but I'll get there...

    Jeroen
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2002
    Location
    Seattle WA
    Posts
    863
    Rep Power
    14
    You're right, the skins won't set the colors, because they're properties of the operating system, not the browser. That is, all those colors are the default ones that any application should use if they don't wish to provide their own color scheme. If an application is skinned or themed in any way (as is mozilla), those color properties won't be affected.

    They're most useful when writing application level programs (that is, executables) that use web-pages. You can write pages that inherit their colors from the operating system, making the pages more seamless with the rest of the operating system.

IMN logo majestic logo threadwatch logo seochat tools logo