Giter Club home page Giter Club logo

Comments (12)

pinkfluid avatar pinkfluid commented on May 20, 2024

A 5th option would be to do it programmatically from a python script (for example, by allowing to override the _init_styles() function)

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

6th option might be to make the default less ugly. I did my best with it, but I'm not exactly Rembrandt. That yellow color in particular probably isn't the prettiest thing in the world...

If someone comes up with a nicer color scheme (or other UI improvement), I'm happy to take it in. Not sticking to just the predefined colors might help too.

The C menuconfig gets decent looks from using lxdialog, but I don't like how it wastes terminal space, and resizing is super janky (including a segfault if you accidentally make the window too small).

from kconfiglib.

pinkfluid avatar pinkfluid commented on May 20, 2024

I don't think it's ugly, actually it's pretty decent even for Rembrandt standards.

The problem is that when I present this to other people they expect the ctools "kconfig" theme. So I was hoping to customize it with colors that are more in-line with the project so instead of a "uh, huh... why is it yellow?" questions I would get more "Oh, cool" reactions :)

It's not super important, so if you think it's pointless to have, please close the issue.

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

I tried to go for the make menuconfig colors at first, but iirc I ran into color clashes due to the more compact layout.

Could you try tweaking the colors manually in _init_styles() and seeing if you can come up with something more make menuconfig-like that looks nice? Once we know that it's possible, I could try to come up with some theming thing.

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

Search for "predefined" in https://docs.python.org/3/library/curses.html to see the list of predefined colors.

Might be able to use curses.init_color() to get custom colors, though it's terminal-dependent (should check curses.can_change_color() in that case too).

from kconfiglib.

pinkfluid avatar pinkfluid commented on May 20, 2024

I will give it a shot.

I thought init_color() was only for RGB-type colors (some terminals do support that). I might try with the standard 16 colors at first, see how far I get.

from kconfiglib.

pinkfluid avatar pinkfluid commented on May 20, 2024

Ok, this is what I came up with. Frankly, it looks more like Norton Commander than lxdialog :)

As you said, it's really hard to match the lxdialog scheme because of the borders and all that.

Anyway, here's the patch:

diff --git a/menuconfig.py b/menuconfig.py
index 2166787..266578e 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -184,7 +184,7 @@ def _init_styles():
 
     # Separator lines between windows. Also used for the top line in the symbol
     # information dialog.
-    _SEPARATOR_STYLE          = _style(curses.COLOR_BLACK, curses.COLOR_YELLOW, BOLD,            curses.A_STANDOUT)
+    _SEPARATOR_STYLE          = _style(curses.COLOR_WHITE, curses.COLOR_CYAN,   BOLD,            curses.A_STANDOUT)
 
     # Edit boxes
     _INPUT_FIELD_STYLE        = _style(curses.COLOR_WHITE, curses.COLOR_BLUE,   curses.A_NORMAL, curses.A_STANDOUT)
@@ -192,25 +192,25 @@ def _init_styles():
     # List of items, e.g. the main display
     _LIST_STYLE               = _style(curses.COLOR_BLACK, curses.COLOR_WHITE,  curses.A_NORMAL                   )
     # Style for the selected item
-    _LIST_SEL_STYLE           = _style(curses.COLOR_WHITE, curses.COLOR_BLUE,   curses.A_NORMAL, curses.A_STANDOUT)
+    _LIST_SEL_STYLE           = _style(curses.COLOR_WHITE, curses.COLOR_BLUE,   BOLD           , curses.A_STANDOUT)
 
     # Like _LIST_(SEL_)STYLE, for invisible items. Used in show-all mode.
     _LIST_INVISIBLE_STYLE     = _style(curses.COLOR_RED,   curses.COLOR_WHITE,  curses.A_NORMAL, BOLD             )
     _LIST_INVISIBLE_SEL_STYLE = _style(curses.COLOR_RED,   curses.COLOR_BLUE,   curses.A_NORMAL, curses.A_STANDOUT)
 
     # Help text windows at the bottom of various fullscreen dialogs
-    _HELP_STYLE               = _style(curses.COLOR_BLACK, curses.COLOR_WHITE,  BOLD                              )
+    _HELP_STYLE               = _style(curses.COLOR_CYAN, curses.COLOR_BLUE,    BOLD                              )
 
     # Top row in the main display, with the menu path
-    _PATH_STYLE               = _style(curses.COLOR_BLACK, curses.COLOR_WHITE,  BOLD                              )
+    _PATH_STYLE               = _style(curses.COLOR_CYAN, curses.COLOR_BLUE,    BOLD                              )
 
     # Symbol information text
     _INFO_TEXT_STYLE          = _LIST_STYLE
 
     # Frame around dialog boxes
-    _DIALOG_FRAME_STYLE       = _style(curses.COLOR_BLACK, curses.COLOR_YELLOW, BOLD,            curses.A_STANDOUT)
+    _DIALOG_FRAME_STYLE       = _style(curses.COLOR_WHITE, curses.COLOR_CYAN,   BOLD,            curses.A_STANDOUT)
     # Body of dialog boxes
-    _DIALOG_BODY_STYLE        = _style(curses.COLOR_WHITE, curses.COLOR_BLACK,  curses.A_NORMAL                   )
+    _DIALOG_BODY_STYLE        = _style(curses.COLOR_CYAN, curses.COLOR_BLUE,    BOLD                              )
 
 
 #

And a screenshot:
2018-08-27-201431_562x362_scrot

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

Doesn't look all too shabby. Bit more relaxed to compared to the other theme.

Maybe I could add it as an alternate theme, enabled in the environment via MENUCONFIG_THEME=aquatic or the like. I'm a bit scared of adding a fine-grained styling mechanism, in case I later decide to make significant changes to the interface (no such plans at the moment, but you never know).

I like that you bolded the selected item. Might steal that for the other theme as well.

Here's how it comes out on gnome-terminal:

skarmbild fran 2018-08-27 22-25-56

from kconfiglib.

pinkfluid avatar pinkfluid commented on May 20, 2024

Actually looks OK even on gnome terminal.

Regarding fine-grained styling -- I believe it's up to the user to maintain the compatibility with newer versions. If they choose to upgrade kconfiglib, they should be aware that their custom theme may require tweaking. In any case, reverting to the default theme should be straightforward. But again, this is a nice to have feature, but far from being essential.

Truthfully, the only issue with the yellow theme is that people usually associate kconfig with the lxdialog color scheme and think that I purposedly changed it to yellow for some reason :)

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

Added the new theme: 84bd863

I tweaked the colors for dialog boxes and the jump-to dialog to make them a bit more readable. Check if looks alright.

Got lazy and went for a hardcoded version for now. Might add some external styling mechanism later, if more styles show up.

from kconfiglib.

pinkfluid avatar pinkfluid commented on May 20, 2024

Looks great, thank you!

You can close this issue.

from kconfiglib.

ulfalizer avatar ulfalizer commented on May 20, 2024

Alright, closing. Thanks!

Pushed out a new release with the theme too.

from kconfiglib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.