Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A function to construct a color by looking it up in the config file
MakeColorSafe() is a gowid function to construct a color based on a string. Gowid walks through various interpretations of the string to try to construct the most likely color. This function adds an interpretation at the beginning, which is as a key in the termshark toml file. This lets you add something like [theme] flashy = "theme.red" red = "#ff0000" Now you can programmatically use "theme.flashy" as an argument and construct a color from it. This function takes an an extra argument, meaning foreground or background. This allows for pairs of colors to be used: [theme] ocean = ["#ffffff", "#0000ff"] // white on blue If you call MakeColorSafe() with "theme.ocean" and theme.Background, you'll get the blue color. Values can refer to other keys in the toml file; this can be done up to 10 times before the function gives up (in case there's a loop).
- Loading branch information