Bug 689903 - Feature Request: Make Newt's system-wide palette configurable at run time
Feature Request: Make Newt's system-wide palette configurable at run time
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: newt (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Miroslav Lichvar
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-22 14:34 EDT by Dustin Kirkland
Modified: 2011-06-27 08:59 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-06-27 08:59:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Make newt's system-wide palette configurable at run time (2.63 KB, patch)
2011-03-22 14:34 EDT, Dustin Kirkland
no flags Details | Diff

  None (edit)
Description Dustin Kirkland 2011-03-22 14:34:36 EDT
Created attachment 486874 [details]
Make newt's system-wide palette configurable at run time

Hello,

We are carrying a small patch in Ubuntu that makes Newt's default color palette configurable, by optionally placing a configuration file at /etc/newt/palette.  

If no file exists at that path, then newt's operation proceeds as normal.

If, on the other hand, a file does exist at that admin-owned location, a list of color values is read from that file and overloaded into the newtColors struct and set with newtSetColors().

I've tested it pretty well and seems to work quite nicely here.

For testing purposes, you can use these two sets of contents for your /etc/newt/palette values.  The contents of the file is expected to contain newt's color keywords, all on a single line, comma-separate, no whitespace, and a total of 44 values.  For example:

original:
white,blue,black,lightgray,black,lightgray,white,black,red,lightgray,lightgray,red,red,lightgray,lightgray,blue,lightgray,red,lightgray,blue,blue,lightgray,black,lightgray,lightgray,blue,black,lightgray,lightgray,red,white,blue,lightgray,blue,blue,red,blue,lightgray,black,lightgray,lightgray,red,black,brown


ubuntu:
white,magenta,black,lightgray,black,lightgray,white,black,red,lightgray,lightgray,red,red,lightgray,lightgray,magenta,lightgray,red,lightgray,magenta,magenta,lightgray,black,lightgray,lightgray,magenta,black,lightgray,lightgray,red,white,magenta,lightgray,magenta,magenta,red,magenta,lightgray,black,lightgray,lightgray,red,black,brown

Please consider committing this patch against your upstream newt branch.  Thanks.

Signed-off-by:
Dustin Kirkland <kirkland@ubuntu.com>
Comment 1 Miroslav Lichvar 2011-05-30 08:13:09 EDT
Instead of requiring all 44 colors on one line I think it would be better to specify color of each item separately. For items which are not specified in the config the default would be used.

Something like:

root=white,black
border=,yellow

Few more things:
- the default path should be configurable in the configure script, /etc/newt/colors by default?
- perhaps it would be useful to be able to override the colors also via getenv("NEWT_COLORS"), e.g. NEWT_COLORS=root=white,black:border=,yellow

I can look into it if you want.

Thanks.
Comment 2 Dustin Kirkland 2011-05-31 14:01:39 EDT
Awesome!  Thanks for the response.  I was worried this bug/patch might have gotten dumped into the bit bucket.

Regarding the format of the file, I just went for the simplest approach, from the perspective of reading the values in the C code.  I didn't expect this to be something that people changed often, frequently, or on their own.  I expected more that a distro or a packager would do this, and probably only ever do it once or twice, so I didn't really think about it in terms of a user-friendly interface, but instead, just as a "functional" one.

Regarding the default path, yes, of course, that could (and should?) very well be configurable.  /etc/newt/colors seemed to me like a simple, straightforward, obvious default.

Regarding a "NEWT_COLORS" environment variable, that's an excellent idea, such that the color scheme could even be modified on an application-by-application, or process-by-process basis (rather than system wide).

I'm concerned a little bit by the complexity of the code necessary to process the descriptive configuration file and/or environment variable.  At this point, I would prefer for you to point me to a git branch with your implementation of these, and I'll gladly build/test that, and port over Ubuntu's use of this functionality to your new implementation.

Cheers,
Dustin
Comment 3 Miroslav Lichvar 2011-06-02 07:43:02 EDT
Ok, I've pushed a patch implementing that to git (git://git.fedorahosted.org/git/newt), please let me know how it works for you.
Comment 4 Dustin Kirkland 2011-06-06 10:47:05 EDT
Awesome, thanks!  I'll get this tested...
Comment 5 Miroslav Lichvar 2011-06-27 08:59:43 EDT
It is in newt-0.52.13.

Note You need to log in before you can comment on or make changes to this bug.