pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.6k stars 199 forks source link

ikhal: initial support for config based ikhal theming #1279

Closed geier closed 11 months ago

geier commented 1 year ago

This PR allows to override ikhal's color theme with a custom palette. This is useful to style certain elements of ikhal individually.

Palette entries take the form of key = foreground, background, mono, foreground_high, background_high where foreground and background are used in "low color mode" and foreground_high and background_high are used in "high color mode" and mono if only monocolor is supported. If you don't want to set a value for a certain color, use an empty string (''). Valid entries for low color mode are listed on the urwid website. For high color mode you can use any valid 24-bit color value, e.g. '#ff0000' (Note: 24-bit color values must be enclosed in quotes).

Most modern terminals should support high color mode.

Example entry: header = light red, default, default, '#ff0000', '#ff0011' See the default palettes in khal/ui/colors.py for all available keys. If you can't theme an element in ikhal, please open an issue on github.

Example config:

image

leads to this ugliness:

image

fixes #1219

tgy commented 1 year ago

just wondering if it would be possible to source another config file within the config

many people use both a 'dark' and a 'light' theme (I do myself: catppuccin latte/frappe) and like being able to switch from one to another depending on the time of the day

with the proposed single file config, this requires having both themes within the config, commenting out one or the other depending on which theme should be applied

geier commented 1 year ago

@tgy for that use case one could write a color theme plugin. I'll upload my first try tonight.

tgy commented 1 year ago

could, we should add documentation for that! i can help

geier commented 1 year ago

@tgy see here https://github.com/geier/khal_gruvbox

Mostly useful for now for finding parts which are not theme-able yet

image
geier commented 1 year ago

could, we should add documentation for that! i can help

we should, but only after we have properly worked out how this is going to work in the long run.

geier commented 1 year ago

complication: the code highlighting days and events in the calendar's color remoes the foreground/background color. We might also need to add different attributes for calendar days and events.

tgy commented 1 year ago

@geier could you share your part of the config with the color definitions you are testing?

i checked out your version of the code in my local environment and will help you test it!

geier commented 1 year ago

@tgy it should be enough to follow the instructions here: https://github.com/geier/khal_gruvbox, if not, I forgot to check something in.

w-jablonski commented 1 year ago

I am unsure of what is the current state of this, but I would really love the option to have weekends coloured differently than weekdays. Thanks.

WhyNotHugo commented 11 months ago

Needs rebase

geier commented 11 months ago

I have removed the color theme plugin part (and moved it to #1303).

geier commented 11 months ago

I am unsure of what is the current state of this, but I would really love the option to have weekends coloured differently than weekdays. Thanks.

good point, tracked in https://github.com/pimutils/khal/issues/1304

Tokariew commented 9 months ago

question i have. How should be colors with spaces in name be edited? like list focused?

geier commented 9 months ago

Did you try wrrapping them like this "list focused" or 'list focused'?