Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
c0ncord2 edited this page Jan 12, 2020 · 2 revisions

Currently theming isn't a finished feature. While most things can already be themed, the theming isn't very granular and some important stuff like the syntax highlighting is currently not themeable at all. If you don't care about code, this might be okay for you though.

Since there is currently no user interface for theming, the theming has to be manually done at the file level. However, manually editing the file is quite painful, since all color values are single integer values.

In case you care, here is an explanation to why those are integers and why it still works: Cordless relies on tview for its rendering and tview relies on tcell, which does the low-level stuff. Therefore tcell is in charge of doing the coloring as well. In tview a color is a type alias for `int`. Since humans wouldn't do very well remembering all those large numbers for all the possible colors, we usually use the RGB or HSL format. In case of tcell, it offers convenience functions for converting RGB values into a 24-bit integer.

Having the following RGB value FF00FF, we'd get the integer (binary representation) 1111 1111 0000 0000 1111 1111. Each piece of the RGB value is exactly 8 bits of the integer. Since we have 3 parts, we need at least 24-bit.

Since manually editing the file would be a pain and there isn't a user interface for it yet, there is a little utility file at https://github.com/Bios-Marcel/cordless/blob/master/tools/theme/theme.go

In that file you can basically just enter your desired RGB values by using the method tcell.NewRGBValue(int, int, int). If you are done deciding on your values, you have to run the file and save its output to the cordless configuration folder in a file called theme.json. In order to run the file, you need to have the latest version of Golang installed.

On linux you'd probably have to run something along the lines of:

go run tools/theme/theme.go > ~/.config/cordless/theme.json

If you want to remove your theme, just delete the theme file and restart cordless. If you want to keep your previous theme, make sure to back it up before overwiting it.

Clone this wiki locally