elfmz / far2l

Linux port of FAR v2
GNU General Public License v2.0
1.78k stars 173 forks source link

Configurable UI themes in a human-readable format #914

Open singalen opened 3 years ago

singalen commented 3 years ago

Quite a lot of users would love to customize the colors of the software they use, or to be able to install existing themes. The current "registry" storage format is a huge roadblock for it.

Could the color schema be stored somewhere in .config/far2l/theme.ini or something .config/far2l/themes/current.ini? #400 has a few wishes for the hypothetical format:

The current color setup UI was nice for its time, but it's soooo dated.

I hope this is not an exact duplicate, as #400 primarily talks about switching color schemes.

Related: #846 has a point too. User menu is a relatively simple structure and could benefit from being stored in an ini file: for example, for an easier migration between computers.

elfmz commented 3 years ago

There is .config/far2l/palette.ini

singalen commented 3 years ago

That's cool! But it only sets the 16 base "ANSI" colors. What I mean by "theme" is a configuration that sets colors of things like:

Currently, we cannot control which is which if two UI elements share the same color.

unxed commented 3 years ago

After configuration is moved from "pseudoregistry" to .ini files, should this issue be renamed to "Expand supported colors range" or something like that? :)

singalen commented 3 years ago

Maybe. I thought the current title covers it, bit it's a bit vague now. The current wording also implies unification of file highlight and UI colors, and a rework of a binary values into a more human-readable format.

elfmz commented 3 years ago

They're not binary but hexadecimal!

singalen commented 3 years ago

My bad!

The format I mean is something that lets us define a palette, and then use its colors for both UI and file highlights. Any software problem can be solved with a new level of indirection!

Here's a raw idea:

# Arbitrary color aliases
[Palette.24bit]
# Supposed red
Warning=#ee0000
# Supposed panel background
Background=#0000dd
SunsetWithAShadeOfSadness=#f37588
...

[Palette.256color]
# https://jonasjacek.github.io/colors/
# Refer by XTerm number for red
Warning=9
# Refer by XTerm name
Background=Blue3
...

[Palette.16color]
# See https://unix.stackexchange.com/a/438357/54895 for xterm color ids, I guess?
Warning=9
Background=Blue
NormalText=6
...

[Palette.8color]
...

[Palette.2color]
...

# Now, use the aliases to define UI colors.
[WarnDialog]
Text=White
Box=Warning
...
[Panels]
Background=Background
...

palette.cpp already has a few sections that would map neatly into ini sections.

The current colors.ini is great; I would only change xxxColor= fields from 0..15 indexes to a color aliases.

400 in such a design would only need to swap existing ini files.

I guess that such ini files don't even need to be written by Far. I guess the whole color customization UI can be dropped. Otherwise, this would require a UI to configure RGB/256-color palettes, and that's an unnecessary work.

unxed commented 3 years ago

Here's a raw idea:

As a developer of the first (and possible only) far2l UI theme, I greatly support this idea. Also 24 bit color support will allow us to have pretty image previews in terminal https://github.com/elfmz/far2l/issues/901#issuecomment-770232384

Serg-VL commented 1 month ago

As I see, there is 24bit support now. So it would be great to implement some predefined themes! I myself prefer white terminal background...