Accessing X Resources - Xwindows

This is a discussion on Accessing X Resources - Xwindows ; Is there a mechanim that allows an application to query an app-default file (or I guess the X environment) for a specific setting? How can I create a new resource so that the application can use the symbolic name and ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Accessing X Resources

  1. Accessing X Resources


    Is there a mechanim that allows an application to query an app-default file
    (or I guess the X environment) for a specific setting?

    How can I create a new resource so that the application can use the symbolic
    name and get the actual value as specified in the apps-default file? For
    example, the application can request the symbolic color "Red" but the
    specific color returned (e.g., "lightsalmon") is specified via the
    apps-default file.

    The above is actually the specific problem I am trying to solve. The
    application wants to display something in "red" but the actual flavor of
    "red" should be controlled externally. This way the Sales team, for example,
    can tweak the actual shade of red for something that loks good on the
    projector while the rest of us can use a "red" that looks good on our
    screens.

    --
    Jake Colman
    Sr. Applications Developer
    Principia Partners LLC
    Harborside Financial Center
    1001 Plaza Two
    Jersey City, NJ 07311
    (201) 209-2467
    www.principiapartners.com

  2. Re: Accessing X Resources

    Jake Colman wrote in
    news:76y8lmqxs5.fsf@newjersey.ppllc.com:
    > The above is actually the specific problem I am trying to solve. The
    > application wants to display something in "red" but the actual flavor of
    > "red" should be controlled externally.


    The easy way is to change the value of "red" in your rgb file.
    A little harder is to write a new string-to-color resource converter that
    looks somewhere other than the rgb file.

    Ken Lee, http://www.rahul.net/kenton/

  3. Re: Accessing X Resources

    >>>>> "KL" == Ken Lee writes:

    KL> The easy way is to change the value of "red" in your rgb file. A
    KL> little harder is to write a new string-to-color resource converter
    KL> that looks somewhere other than the rgb file.

    How can I see what the rgb.txt colors translate to visually?

    My problem is that my application wants to related things in the same color
    but it does not care about the specific color - as long as it is the same in
    all cases. Therefore, I want to use a symbol for the color and allow the
    color to be plugged in at run-time. So I might display something as
    'RedComplement' foregound on top of 'Red' background but the user can decide
    what "Red" actually means.

    Ideally, by the way, UIL colors would work the same way - but that's probably
    not possible.

    --
    Jake Colman
    Sr. Applications Developer
    Principia Partners LLC
    Harborside Financial Center
    1001 Plaza Two
    Jersey City, NJ 07311
    (201) 209-2467
    www.principiapartners.com

  4. Re: Accessing X Resources

    Jake Colman wrote:
    >
    >Is there a mechanim that allows an application to query an app-default file
    >(or I guess the X environment) for a specific setting?
    >
    >How can I create a new resource so that the application can use the symbolic
    >name and get the actual value as specified in the apps-default file? For
    >example, the application can request the symbolic color "Red" but the
    >specific color returned (e.g., "lightsalmon") is specified via the
    >apps-default file.
    >
    >The above is actually the specific problem I am trying to solve. The
    >application wants to display something in "red" but the actual flavor of
    >"red" should be controlled externally. This way the Sales team, for example,
    >can tweak the actual shade of red for something that loks good on the
    >projector while the rest of us can use a "red" that looks good on our
    >screens.


    As usual, this is something you can do with an environment variable.

    The translation of red to #ff0000 (usual def) is coming from the rgb.txt
    database. Now just a couple of days ago, I was writing in the very group
    about its problems -- funny coincidence.

    The rgb.txt database is something known to the server, but if you use
    the Xcms* functions, they all work on a database known to Xlib. And this
    is normally /usr/X11R6/lib/X11/Xcms.txt (or equivalent), but can be
    overridden by an environment specification.

    My little test is as follows:

    oclock -fg red --> clock with red hands

    create a file called /home/kbr/cmsdb with these contents

    XCMS_COLORDB_START 0.1
    red rgb:00/FF/00
    XCMS_COLORDB_END

    (which obviously re-assigns red to green)

    and try

    XCMSDB=/home/kbr/cmsdb oclock -fg red --> clock with green hands

    Despite my obvious abuse of this facility, it could be a clean way for
    you to provide 'sales with their own color palette.


  5. Re: Accessing X Resources

    In comp.windows.x, Kip Rugger

    wrote
    on 14 Jul 2004 16:23:36 -0500
    :
    > Jake Colman wrote:
    >>
    >>Is there a mechanim that allows an application to query an app-default file
    >>(or I guess the X environment) for a specific setting?
    >>
    >>How can I create a new resource so that the application can use the symbolic
    >>name and get the actual value as specified in the apps-default file? For
    >>example, the application can request the symbolic color "Red" but the
    >>specific color returned (e.g., "lightsalmon") is specified via the
    >>apps-default file.
    >>
    >>The above is actually the specific problem I am trying to solve. The
    >>application wants to display something in "red" but the actual flavor of
    >>"red" should be controlled externally. This way the Sales team, for example,
    >>can tweak the actual shade of red for something that loks good on the
    >>projector while the rest of us can use a "red" that looks good on our
    >>screens.

    >
    > As usual, this is something you can do with an environment variable.
    >
    > The translation of red to #ff0000 (usual def) is coming from the rgb.txt
    > database. Now just a couple of days ago, I was writing in the very group
    > about its problems -- funny coincidence.
    >
    > The rgb.txt database is something known to the server, but if you use
    > the Xcms* functions, they all work on a database known to Xlib. And this
    > is normally /usr/X11R6/lib/X11/Xcms.txt (or equivalent), but can be
    > overridden by an environment specification.
    >
    > My little test is as follows:
    >
    > oclock -fg red --> clock with red hands
    >
    > create a file called /home/kbr/cmsdb with these contents
    >
    > XCMS_COLORDB_START 0.1
    > red rgb:00/FF/00
    > XCMS_COLORDB_END
    >
    > (which obviously re-assigns red to green)
    >
    > and try
    >
    > XCMSDB=/home/kbr/cmsdb oclock -fg red --> clock with green hands
    >
    > Despite my obvious abuse of this facility, it could be a clean way for
    > you to provide 'sales with their own color palette.
    >


    It's only an abuse if one uses an existing color. :-)

    Try using 'fred', for example. Or 'border' or 'flgirliwnxxu'.

    --
    #191, ewill3@earthlink.net
    It's still legal to go .sigless.

  6. Re: Accessing X Resources

    Jake Colman writes:

    >>>>>> "KL" == Ken Lee writes:

    >
    > KL> The easy way is to change the value of "red" in your rgb file. A
    > KL> little harder is to write a new string-to-color resource converter
    > KL> that looks somewhere other than the rgb file.
    >
    > How can I see what the rgb.txt colors translate to visually?


    The program xco shows these colors.

    ftp://ptah.lnf.kth.se/pub/misc/xco.tar.gz

    --
    - Mårten

    mail: msv@kth.se *** ICQ: 4356928 *** mobile: +46 (0)707390385

+ Reply to Thread