#63 Color Dialog

development
closed-accepted
Nathan Gray
Program (79)
5
2003-03-07
2002-08-15
Nathan Gray
No

This patch against CVS HEAD adds a color dialog
to NEdit. It has some nice features:

* Ability to change text fg/bg, selection fg/bg,
highlighted fg/bg, line number color, and cursor
color.

* Instant, as-you-type validation of color names
(similar to font names in the font dialog).

* Since colors are now stored in .nedit you
can't have mismatched plain/syntax highlit colors.

* Ability to fill Default Settings -> Colors dialog
with colors from current window. (We should add
this to the font dialog too, IMO.)

There's also an enhancement of the font browser
that changes the sample display to an editable text
field with appropriate coloring. This is still buggy
though, and might not be worth the trouble.

Discussion

  • Nathan Gray
    Nathan Gray
    2002-08-15

    Version 1.0 of the color dialog patch

     
    Attachments
  • Nathan Gray
    Nathan Gray
    2002-08-15

    Logged In: YES
    user_id=121553

    I would be grateful if somebody who understands
    allocating X
    colors would look at my uses of AllocColor and tell me if
    I'm wasting server resources in a horrible way. Other
    than that I don't think there's anything complicated
    about this patch.

     
  • Nathan Gray
    Nathan Gray
    2002-08-17

    Snapshot of the color dialog.

     
    Attachments
  • Nathan Gray
    Nathan Gray
    2002-08-17

    Logged In: YES
    user_id=121553

    Adding a screenshot...

     
  • Nathan Gray
    Nathan Gray
    2002-08-17

    Snapshot of the default settings color dialog

     
  • Nathan Gray
    Nathan Gray
    2002-08-17

    Logged In: YES
    user_id=121553

     
  • Nathan Gray
    Nathan Gray
    2002-12-05

    Logged In: YES
    user_id=121553

    Another screenshot, this time with some colors actually
    changed. :^)

     
  • Nathan Gray
    Nathan Gray
    2002-12-05

    Look! The colors change!

     
  • TK Soh
    TK Soh
    2002-12-06

    Logged In: YES
    user_id=411637

    I only tried it for few minutes just now, but very nice
    feature indeed. I think all other resources should have
    similar dialogs :-)

    One problem I noticed: it didn't pickup my overriding
    resource, neither through .Xdefaults nor -xrm.

     
  • Nathan Gray
    Nathan Gray
    2003-02-17

    Logged In: YES
    user_id=121553

    I just added a new patch that is up-to-date with current
    CVS. I've also fixed all issues I was aware of with the
    font browser enhancement, so I think this version is
    ready to go. If somebody could hammer on it a bit
    though I'd be pleased.

    TK: The reason it didn't use your resources is that the
    resources have changed from text widget resources to
    application resources that live in the .nedit file. So
    where you used to have "nedit*text.foreground" in
    .Xdefaults you now have "nedit.textFgColor" in .nedit.
    These are the new resources:
    nedit.textFgColor
    nedit.textBgColor
    nedit.selectFgColor
    nedit.selectBgColor
    nedit.hiliteFgColor
    nedit.hiliteBgColor
    nedit.lineNoFgColor
    nedit.cursorFgColor

    You can still override them from the command line or a
    .Xdefaults if you wish.

     
  • Nathan Gray
    Nathan Gray
    2003-02-17

    Version 2.0 of the color dialog patch

     
    Attachments
  • Logged In: YES
    user_id=241391

    Very nice feature. I like it a lot.

    Maybe I am missing an obvious thing, but I can't see
    any color change when I play with highlighted fg/bg.
    What should it be applied to?

    Unfortunately, this patch has currently little meaning
    for Joe an average user because it lacks the GUI
    facilities of browsing the existing color database and
    viewing the current chosen color. The user still has
    to rely on external tools like xcolormap, xcolorsel
    etc. so that to make a conscious choice.

    Anyway, this is much better than nothing at all.

    W.r.t the possibility of font sample text editing,
    I personnaly don't see any application for that.

     
  • Nathan Gray
    Nathan Gray
    2003-02-17

    Logged In: YES
    user_id=121553

    "Maybe I am missing an obvious thing, but I can't see
    any color change when I play with highlighted fg/bg.
    What should it be applied to?"

    I think it only applies when you enable "show matching".
    Internally it's called the highlighting color but that's
    probably not a good name for the dialog to use.

    I agree that it would be good to have a GUI color
    selector, and that's the next step. But we'll still need
    something like this dialog, and it can easily be extended
    to take advantage of a color browser. I still think it's a
    big step forward because the current method is
    something like:

    0. Figure out that you have to use a .Xdefaults file to
    change colors in nedit. (This is not at all obvious to a
    new user.)
    0.5 Figure out how .Xdefaults files work and how to
    make sure they get loaded when X starts. (This is not
    automatic in many Linux distros.)
    1. Figure out what valid colors exist.
    2. Try a color in .Xdefaults
    3. Run xrdb -merge .Xdefaults
    4. Start nedit
    5. See if you like the color.
    6. Quit nedit.
    7. Loop to 2 until satisfied.

    With the dialog it'd be:

    1. Find the color dialog.
    2. Figure out what colors can be used. (You can
    always use #RRGGBB after all, and the "invalid color"
    feedback helps when experimenting with colors.)
    3. Try a color.
    4. Hit apply.
    5. Loop to 3 until satisfied.
    6. Save preferences.

    "W.r.t the possibility of font sample text editing,
    I personnaly don't see any application for that."

    The idea is that a font can look very different when
    viewed black on white than it looks as white on black.
    And to really see how a font reads you might want to
    type some actual words in it. How often do you actually
    type "ABCDEFGHIJK..."? Wouldn't it be more helpful to
    find out how "for (i=0; i<x; i++) {" looks in the font?

     
  • Nathan Gray
    Nathan Gray
    2003-02-17

    Logged In: YES
    user_id=121553

    "Maybe I am missing an obvious thing, but I can't see
    any color change when I play with highlighted fg/bg.
    What should it be applied to?"

    I think it only applies when you enable "show matching".
    Internally it's called the highlighting color but that's
    probably not a good name for the dialog to use.

    I agree that it would be good to have a GUI color
    selector, and that's the next step. But we'll still need
    something like this dialog, and it can easily be extended
    to take advantage of a color browser. I still think it's a
    big step forward because the current method is
    something like:

    0. Figure out that you have to use a .Xdefaults file to
    change colors in nedit. (This is not at all obvious to a
    new user.)
    0.5 Figure out how .Xdefaults files work and how to
    make sure they get loaded when X starts. (This is not
    automatic in many Linux distros.)
    1. Figure out what valid colors exist.
    2. Try a color in .Xdefaults
    3. Run xrdb -merge .Xdefaults
    4. Start nedit
    5. See if you like the color.
    6. Quit nedit.
    7. Loop to 2 until satisfied.

    With the dialog it'd be:

    1. Find the color dialog.
    2. Figure out what colors can be used. (You can
    always use #RRGGBB after all, and the "invalid color"
    feedback helps when experimenting with colors.)
    3. Try a color.
    4. Hit apply.
    5. Loop to 3 until satisfied.
    6. Save preferences.

    "W.r.t the possibility of font sample text editing,
    I personnaly don't see any application for that."

    The idea is that a font can look very different when
    viewed black on white than it looks as white on black.
    And to really see how a font reads you might want to
    type some actual words in it. How often do you actually
    type "ABCDEFGHIJK..."? Wouldn't it be more helpful to
    find out how "for (i=0; i<x; i++) {" looks in the font?

     
  • Nathan Gray
    Nathan Gray
    2003-03-07

    • assigned_to: nobody --> n8gray
    • status: open --> closed-accepted
     
  • Nathan Gray
    Nathan Gray
    2003-03-07

    Logged In: YES
    user_id=121553

    The patch has been applied to CVS.